Gitlab + Mattermost on Ubuntu 16.04

In this post, we

  1. Install gitlab omnibus and enable mattermost
  2. Get mattermost to accept gitlab credentials
  3. Use ports and a second domain name we have full control over to get around not being able to install mattermost in a subdirectory
  4. Solve an annoying “Failed to upgrade websocket connection” error in Mattermost that means it doesn’t have real-time services
  5. Learn how to purge mattermost data

Specifically, we have two domain names.
a) (in our case, a .edu domain), which all our files will be created on
b) (in our case, a domain we registered separately through godaddy)

To resolve that we a) cannot create subdomains on the organizational domain, and b) must install mattermost on a subdomain, not a subdirectory, we will create subdomains on and point them to ports on the organizational domain –> –>

Install Gitlab Omnibus, Community Edition, for the first time
(Note: Omnibus i think just refers to the official latest and greatest gitlab release)
0a. Add gitlab repository as per
0b. sudo apt-get install gitlab-ce

If not first time: Uninstall and Purge Gitlab Data
1. sudo gitlab-ctl uninstall
Stop gitlab processes
2. sudo gitlab-ctl cleanse
Remove all omnibus-gitlab data
3. sudo apt-get remove gitlab-ce

Reinstall Gitlab
4. sudo apt-get install gitlab-ce
5. sudo gitlab-ctl reconfigure

Re-configure Gitlab
6. sudo vi /etc/gitlab/gitlab.rb
6a. external_url “″
6b. mattermost_external_url ‘′

(Note: these ports, 8001 and 8007, were arbitrarily chosen and just needs to match Apache’s configuration in /etc/apache2/sites-enabled/gitlab.conf & /mattermost.conf)

7. sudo gitlab-ctl reconfigure

8. Go to
8a. It will ask you to set a password
8b. Sign in to gitlab, the username is root and you just set the password

Reconfigure Mattermost
9. Get mattermost to accept gitlab’s single-sign-on
9a. On, go to Profile Settings > Applications

Add new applications
Name: Mattermost
Redirect URI:
Save Application

You will get an Application ID and Secret, which you will use in the next step.

9b. Edit /etc/gitlab/gitlab.rb, uncomment and fill out
mattermost[‘gitlab_enable’] = true
mattermost[‘gitlab_id’] = “12345656”
mattermost[‘gitlab_secret’] = “123456789”
mattermost[‘gitlab_scope’] = “”
mattermost[‘gitlab_auth_endpoint’] = “”
mattermost[‘gitlab_token_endpoint’] = “”
mattermost[‘gitlab_user_api_endpoint’] = “”

(Note to self: make sure to put “git.your-domain” and not “gitlab.your-domain” to keep everything consistent)

10. sudo gitlab-ctl reconfigure

Test it!
11. On gitlab, register a non-admin account

12. On gitlab, sign out as root and signin as foobar

13. Go to
13a. Create an account with Gitlab Single Sign-On
13b. Authorize

14. Create a new team
15. Team Settings > Allow any user with an account on this server to join this team: Yes

16. Make sure real-time communications work: open a new tab and make sure you don’t need to refresh to see the chats update


Alternative way to purge Mattermost data:

Getting the Mattermost CLI to work in Gitlab Omnibus
The Mattermost CLI is documented here
However as we are using Mattermost as part of Gitlab, it is a bit finicky [1] and we must use this shell script:

$ sudo vi

cd /opt/gitlab/embedded/service/mattermost
sudo -u mattermost /opt/gitlab/embedded/bin/mattermost -config=/var/opt/gitlab/mattermost/config.json $@

$ sudo sh -help
(Just to check that the script is working)

Now, to delete a team:
$ sudo sh -permanent_delete_team -team_name=”first slack team”
Have you performed a database backup? (YES/NO):
(Otherwise it will abort)


[1] Credit to:

Troubleshooting: Misc
sudo cd` fails; switch to interactive mode using `sudo -i` and then run your commands. (eg `cd`)
sudo service apache2 restart
a2dismod & a2enmod

Troubleshooting: Log Locations
sudo gitlab-ctl tail
sudo tail -f /var/log/gitlab/mattermost/mattermost.log
sudo tail -f /var/log/apache2/error.log
sudo tail -f /var/log/gitlab/nginx/gitlab_mattermost_access.log
sudo tail -f /var/log/gitlab/nginx/error.log

Troubleshooting: Firewalls?
$ sudo netstat -plnt | grep :8001
(you should see
tcp 0 0* LISTEN 12668/nginx
Else, if the port isn’t in use, you’ll see nothing)


$ nc -l 8001
( you should see
nc: Address already in use
Else, you’ll see nothing)

If the port is open and not firewalled, you should be able to talk to yourself
In tab one: $ nc -l 8002
In tab two: $ nc 8002
Whatever you type in one tab should show up in the other

Notes: Apache Configuration to avoid Mattermost websocket errors

For proper websocket updating, you must enable
$ sudo a2enmod proxy_wstunnel
(Just in case, though gitlab install should have enabled this:
sudo a2enmod proxy_http)
$ sudo service apache2 restart

/etc/apache2/sites-enabled$ sudo vi mattermost.conf

<VirtualHost *:80>
ServerSignature Off
ProxyPreserveHost On

<Location />
Require all granted
RewriteEngine on
RewriteCond %{REQUEST_URI} ^/api/v3/users/websocket [NC]
RewriteRule /(.*) ws://$1 [P,L]
RewriteRule .*{REQUEST_URI} [P,QSA]


The bolded lines essentially catch requests by Mattermost to the websockets API and makes sure they are redirected to ws://

(Otherwise you will not get real time updates and will get lots of ” Failed to upgrade websocket connection” in the Mattermost log, var/log/gitlab/mattermost/mattermost.log)

Credit to is identical, minus the two bolded websocket lines; and with URL and port changed.

<VirtualHost *:80>
ServerSignature Off
ProxyPreserveHost On
<Location />
Require all granted
RewriteEngine on
RewriteRule .*{REQUEST_URI} [P,QSA]
# needed for downloading attachments
DocumentRoot /opt/gitlab/embedded/service/gitlab-rails/public

Credit to &


Installing Grav (a flatfile alternative to WordPress?) on Ubuntu 16.04

Jump down to “1. Install” if you just want the five-minute walkthrough I worked out for Ubuntu 16.04.

Grav Backend
Grav Backend

0. Background

I recently ran across Grav, “A modern open source flat-file CMS”. It looks like a promising alternative to WordPress that should be easier to customize to do what I want.

The lack of a need for a database should make installing on servers less painful as well. I also like the idea of writing in my posts in Markdown by default — I often struggle on my current wordpress-based blog with formatting issues. However, I still want drag-and-drop image support, since many of my blog posts are image heavy.

Additionally, last year (for grad school applications) I made an attempt at a separate portfolio site, using Jekyll with the Freelancer theme by Start Bootstrap. However, it left to be desired in terms of ease of updating and more.

Screenshot from 2016-11-24 17:58:47
My portfolio site, ||

I took a chance and tried out Grav, and really liked what I saw.

Grav Admin Interface
Grav Admin Interface
Grav Drag and Drog Image GUI
Grav Drag and Drog Image GUI


Screenshot from 2016-11-24 17:20:30
Grav Markdown Page Editor
Grav TwentyFifteen Skeleton (a port of WordPress TwentyFifteen theme)
Grav TwentyFifteen Skeleton (a port of WordPress TwentyFifteen theme)

I can already see some cons, though. For one, it’s not easy to tell which themes are compatible with your existing site structure.

Oh well, maybe in a few years something better will come along. I decided I was intrigued enough to sink a few days into learning how to operate and customize Grav.

1. Install

The main errors I worked through were a missing PHP module and a permissions error.

(Some of these errors only showed up when I saved a page or tried to upload an image. See section 3 for the exact errors I was getting).

Note: I chose to install under /var/www/html/grav so everything shows up at http://localhost/grav, but you can definitely do everything directly under /var/www/html

From the grav homepage,, go to Downloads, and then to Skeletons.

We will be using a Grav Skeleton, specifically the one called “TwentyFifteen Site”.

A Grav Skeleton is effectively an all-in-one sample site. They include the Grav Core, required plugins, as well as appropriate pages for content and a theme for pulling it all together. [src]

SSH / Login to your server.

Note: Apache2 should already be installed by default. If you go to /var/www/html you should find an index file (“Apache2 Ubuntu Default Page”) that should also show up when you go to either localhost or your domain name (e.g. in your browser.

sudo apt-get install unzip
cd /var/www/html 
sudo unzip
mv grav
cd grav
sudo vi
chown www-data:www-data .
chown -R www-data:www-data *
find . -type f | xargs chmod 775
find ./bin -type f | xargs chmod 775
find . -type d | xargs chmod 775
find . -type d | xargs chmod +s
umask 0002
sudo sh ./
sudo add-apt-repository universe
sudo apt-get install php7.0-fpm php7.0-cli php7.0-gd php7.0-curl php7.0-mbstring php7.0-zip php-apcu php7.0-xml
sudo service apache2 restart

Go to (or localhost/grav/admin)

  • You should be prompted to create a user
  • Login to admin
  • Create and save a page with an image in it

If this works, everything should be great!

2. Troubleshooting

Here I document miscellaneous things I did and tricks I learned.


The permissions fix came from Grav documentation, under “11. Troubleshooting” > “Permissions”:


Grav needs PHP 5.5.9 or higher.

$ php -v

PHP 7.0.8-0ubuntu0.16.04.3

To check which modules are enabled, we can set up use phpinfo()

/var/www/html$ sudo vi test.php
<?php phpinfo(); ?>

Then go to http://localhost/test.php and e.g. search for “mbstring”

Make sure to remove this file after you’re done.

Enable Universe repository

The other issue I ran into was not realizing I couldn’t sudo apt-get install the missing PHP modules because I hadn’t enabled the universe repository.

nrw@the-PC:~$ cat /etc/apt/sources.list


To enable an Apache module:

$ sudo a2enmod rewrite

(to disable: sudo a2dismod)

$ sudo service apache2 restart

Grav Troubleshooting Features

You can enable the Debug Bar

$ sudo vi /var/www/html/grav/user/config/system.yaml
    enabled: true

Also the Error Display

$ sudo vi /var/www/html/grav/user/config/system.yaml
    display: true

Grav Logs

The logs are at /logs/grav.log

$ tail -f /var/www/html/logs/grav.log

3. Appendix: Errors

The specific errors I encountered

‘mbstring’ extension is not loaded. This is required for Grav to run correctly

Permission denied in /var/www/html/grav/vendor/rockettheme/toolbox/File/src/File.php

0 – An exception has been thrown during the rendering of a template (“The cache/gpm folder is not writable. Please check the folder permissions.”) in “partials/plugins-list.html.twig” at line 19.
if (is_file($path . ‘/’ . $this->_original->name())) {
rename($path . ‘/’ . $this->_original->name(), $path . ‘/’ . $this->name());

“rename(/var/www/html/grav/user/pages/,/var/www/html/grav/user/pages/ Permission denied”

Wifi: Connect to eduroam & permanently store password (ubuntu 14.04 with cinnamon, with MIT account)

NOTE 27 Dec 2019: below may be out-of-date; for up-to-date and for Android instructions, see new post:

OUTDATED (kept as techniques may be useful for troubleshooting)

With your MIT account and your athena password you can connect to the “eduroam” wireless network present in many universities.

Follow KB instructions to add the eduroam via GUI

Unfortunately for me, I could not “edit” the eduroam connection. Instead I “added” eduroam as a new connection.

Network Connections > Add > Wifi > Create >

Connection Name: FOOBAR

SSID: eduroam

Screenshot from 2016-11-13 15:46:05



security: WPA & WPA2 Enterprise

authentication: PEAP

CA Certificate: /etc/ssl/certs/AddTrust_External_Root.pem (this file already existed on my filesystem, I did not need to download it)

Screenshot from 2016-11-13 15:45:59

Storing the password

When I did the above steps, I could connect to eduroam, but I would have to type in my password each time. This gets annoying especially on unstable connections.

I’m not sure the exact trick, but essentially, use

$ nmcli con status

to find the UUID. Something like “dd4ad68a-dc57-420d-856c-3aca862652a3”

Then create a file,

/etc/NetworkManager/system-connections$ sudo vi FOOBAR-dd4ad68a-dc57-420d-856c-3aca862652a3

Inside the file put the contents as follows.

(Note that this is the same contents as in the “FOOBAR” file in the same folder, that the GUI created for us when we added the eduroam connection in the network-manager in the first step. Except! We we add the line:


and we change the flag from 1 to 0:








Now you should  be able to connect to eduroam by selecting it in the network manager GUI, and it should connect without

To test, try switching to another network and switching back.

Useful commands:

$ sudo restart network-manager
$ nmcli con up id eduroam
$ nmcli con status

is located in the 7th Congressional district of Georgia.The representative for this district is:Rob Woodall Republican (where is climate and women’s rights??)

Candidates Elected: Officials Elected Statewide
District Maps: Congressional District Maps
U.S. Congress: District 007
Georgia Senate: District 048
Georgia House: District 097
Click Here for Qualified Candidates


Rainbow!~ Challah (Pt2)

Only a year late (for pt2), but following on part 1 (rainbow heart cookies), rainbow challah!





Eh, it’s late so here’s a photodump instead.

  1. make sure to use gel food coloring, not normal food dyes (which are watery and won’t give you vibrant colors)
  2. make challah dough. You’ll need:
    yeast, eggs, salt, all-purpose flour, honey, and optionally butter
  3. 1/3 is white and the remaining 2/3 are split evenly among the colors (six for a full rainbow).
  4. leave it sitting for an hour under a moist paper towel (so it doesn’t dry out) until it’s doubled in size 😀
  5. braid it (see youtube)
  6. for ours, we smushed the colors side by side, then cut it into six chunks long-ways, then stretch each of the six chunks out, and THEN we braided the chunks together.
  7. So each “strand” of the braid by itself had six colors, so braided together it became super colorful!
  8. if you want, put egg white + cinnamon paste on it (you can see we made two kinds)
  9. put it in the oven (at 350F for half an hour or so, until it’s a golden brown)
  10. slice and eat 😀

musings on fashion and identity — practical edition

as continued from

=== gallery / inspiration === (“Uzzlang Board” … what is an uzzlang?) (Pinterest Androgynous Fashion) (female sherlock)

rolling up of the sleeves, open collar with tshirt underneath, untucked shirt, thumb in pocket:$585×585$ (1930s Hollywood Classic style masculine female dress)


Eddie Izzard on fashion

Break Free “A short film about gender roles, Trans, and what it is like to have an identity that deviates from the status quo.”

Behind the scenes of ‘Break Free’ (you can see the makeup at 3:35 )

=== my work so far ===

=== clothing ===

men’s sizing is different (and much more sensible really).

i tried at first going to thrift stores. i realized quickly that this wasn’t going to work. goodwill’s isn’t sorted by size, and most thrift men’s clothes are not going to be in sizes i can wear.

I took my tape measure and measured myself.

  • inseam goes from crotch to ankle (not floor!)
    • 27” inseam / 34” waist, for pants
    • 14” neck / 30” sleeve (from center back of neck, to wrist, with arm hanging down) for collared shirt

then i went to a “real” store (H&M) and found roughly the right sizes, and tried on several size variations of the same thing.

for jeans:

  • slim fit size 28 — nope
  • relaxed skinny fit size 33 — nope — length is okay, the waist is even like a balloon around me
  • regular waist, size 29 — actually works. an inch too long, but fits me better than 95% of my actual jeans. Then again, I’ve *never* shopped for jeans on my own / by trying multiple sizes on to see what fit well, so possibly there’s women’s sizes that fit me even better… but really who wants to deal with “size 4 6  peitite” sizing crap
  • sock

for shirts:

  • size XS — seems to work reasonably well — two inches too long on the sleeves, and fitted enough that it reveals i have more hips than chest
  • you want to elongate your neck, so v cuts are better than tight collars
  • reference


  • 77 cm inseam –  27” inseam (31” to floor)
  • 34” waist
    • hips 35”, butt 37”
  • 29” back of neck to wrist (23” from side of neck to wrist)
  • 14” around my neck
  • 9” from center base of neck to center shoulder
  • chest 29”
    • 33”  across breasts, 32” on the lower slope
  • 32” (no less than 31”) waistline (under belly button, above hips)

so, 27/34 pants, 14/30 shirt

turns out men’s (shirt?) sizes can go to the half inch, so i might want to measure again someday.

update 25 July 2018: “Jeans sizes are often given in inches, e.g. 30/32. The first number is the waist measurement and the second is the inner leg length.” — so, 29/30 (30 is shortest)

= >< =

I ended up getting:

  1. collared grey shirt (halftone color) $25
  2. collared blue shirt (solid color) $20
  3. black cargo pants (pockets are bulky and make me look more short) $35
  4. blue jeans $25

For my advisor meeting, I wore #1 and #4 together, they seemed like the best combination.

(i don’t feel like posting pictures, sorry)

I think next time, I’ll wear an undershirt (with a binder) and have the collared shirt draping (to give more of a straight line from shoulders to butt ). “button down casual” style

Oh, and I’d switch to a shorter (in the back) wig.

= > $$$ < =

The two sets of H&M clothes came out to be $100 !!!!! ;__; The cost I pay for a really impulsive decision.

(although, hopefully now that I know my sizes I can aliexpress the rest).

With 5 tshirts, 3 button-downs, and 2 pants, I’ll have 30 outfits.

[Update 30 Aug 2017: the tshirts (undershirts) can be pretty inexpensive, since

Some more ideas of costs:

=== hair ===

  • i’m keeping my actual hair long. i like the feeling of having my hair braided too much, and it invites less questions in my non-Harvard life
  • wig it is!
    • i needed this same day. boston costume wasn’t helpful, and i was going to go check out dorothy’s boutique. fortunately a friend (julia hopkins!) lent me a wig

I did two ponytails and wrapped them around my head with bobby pins and clips. i wonder if the back of my head had a weird lump. the wig seemed to hold up fine, and even stayed on through biking, although it was hard to tell without bangs in my eyes whether it had slipped up, which was nerve-wracking.

wig (for izaya cosplay, lent to me by julia hopkins)


i haven’t really thought about what to do in terms of sports and exercise and martial arts. erm? i’ll figure it out later. (and showers!)

[Update 30 Aug 2017: The $10 wig I got from Amazon Prime works surprisingly well, few people seem to realize on their own that I’m wearing a wig. I keep getting compliments on my haircut.

An important thing I learned though, is that wigs are adjustable in circumference! The weird dangly things around where your ears are on the wig, are for adjusting to how big your head is. The first time I wore it, my wig kept slipping off and eventually fell off as I was biking!! But I didn’t put anything on except the wig.

The second day, I made the wig a big smaller, and got some of the thicker longer black bobby pins (so expensive, $5 for 20 at walgreens), and life is good aside from the constant anxiety that people will figure out I’m wearing a wig, and that my wig might be falling off. The pins are a little shiny, and so I always worry that they’re sticking out — it’s really hard to see the top and back of your head by yourself.

I had a braid originally, but some “athletic” hair bands with a ponytain held up by the pins and some heavier-duty hair clips have worked well.

I suspect I’m still not quite androgynous though. Alas, something to work on over the course of the year.]

=== shoes ===

Apparently men’s shoes sizes, are just women’s shoe sizes minus 1.5. So I’d be around a 6.5 mens, and I think the smallest size at H&M was 8.

i ran out of time, and even the smallest size at H&M was way too big. In the end I just went with some black (nominally women’s) flats I got from target a while ago, to serve as my comfortable business casual black shoes.

Black boots though… I want a set. (Although I still have trouble distinguishing between things I like, and things I like wearing on myself).

=== accessories ===

giant watches? i was trying to source a <$10 one, but decided I was going too hard for trying to pass as “white business casual guy” . Instead I could aim for the pretty androgynous asian boy.

=== makeup ===

i’m pleasantly surprised at how, even if it’d day-to-day and not drag king-ing, makeup isn’t obvious even if you’re looking up close. i can tell that my face is a little shinier and smoother, but if it’s blended smoothly, it’s not super obvious I have makeup on even when I have A LOT on. the following is all e.l.f. brand from target

the easiest way i found, is

  • a small “eyeshadow” brush ($1)
    • a bit of dark eyeshadow ($3)
    • a light foundation and a dark foundation (relative to my skin)
      • light foundation on the center of nose, above the cheekbones, on the lips, top side of chin,
      • dark foundation in the hollow between the eyes and nose, on sides of nose, under cheekbones, right on jawline
    • blend the heck out of it all with a makeup sponge (little triangles that are squishy). i tried a soft “foundation” brush, but the contrasts are too heavy for it
    • optionally, “set” with a transparent powder (keeps it from smearing off as much, i guess, and keeps it from being too shiny and obvious you have makeup on)

if i actually wear this on a day-to-day basis, i’ll invest in more quality makeup, since it *is* going on my skin

makeup can also be for actual guys

=== breasts ===

a sports bra works great for me.

in terms of things I’ve tried: sports bandages for binding are cheap and readily available at target for $2. (everyone on the internet will tell you this is bad over the long term, but for a next-day thing it worked fine). the self-stick kind is a no-no, impossible to use. i got the elastic kind, which possibly is better than the athletic kind, but certainly not great. the analogy is, elastic means it’s like a rubber band — the more you stretch it, the harder it compresses. except here, stretching = you trying to breathe. it came with velcro hooks at either end, which worked well (I guess otherwise you get clips?)

tutorials on crossplay (“open chest crossplay“) use tape, or bandages, or cut-up leggings (i tried pantyhose, it was wholly ineffective since it was so lightweight)

binders may be the way. so, ebay / aliexpress in the future


I’m in part doing this, since grad school is a fun time to experiment around, that I might not get if I were in industry or being judged by my superiors later in my career. There is some excitement [2]. It makes me feel like I’m expressing a bit of the way i’ve always felt weirdward of normal society. (I sense some rainbow hair in my future).

Katie Kuffel
Katie Kuffel

[2]  since it’s a choice i’m making without much fear of negative repercussion professionally or socially, just the same social anxieties i faced when i started putting on dresses and in particular experimenting with makeup

of course, i’ve the $$$ to do so; it’s kind of funny, as questionable content’s current story arc is also about this.

my public reply to Sen. David Perdue (GA)’s email

please stop saying Washington this Washington that, as if you are not a part of Washington and have a responsibility to work with other people in Washington

also please add an unsubscribe link to your emails

i know you, as a political entity, legally don’t have to abide by CAN-SPAM regulations but really, if you won’t give me an email address to reply to*, it’s just basic decency to give me a choice to unsubscribe from these one-sided propaganda blasts

*and worse, given the lack of email address, I have to resort to the contact form on your website which signed me up for this spam I can’t unsubscribe from in the first place

from: Senator David Perdue <>
Direct from David: Adding Value

Growing up in Middle Georgia, my father taught me to add value. He’d say, “David, don’t ever worry about the job ahead of you, just take care of the one you’ve got now.”

For me, after four decades in business, the job may have changed but the principle remains the same.

In the United States Senate, I’m committed to solving our $19 trillion national debt crisis. We cannot wait any longer.

What Washington is doing by digging us deeper into debt is not acceptable. We need a sense of urgency to focus on results.

That’s why I’m using my private sector expertise to help solve our financial problems and motivate my colleagues to make some tough decisions.

As an outsider to the political process, my perspective will always be different. With your help, I’m optimistic we can solve our debt crisis and unleash an economic boom.

God Bless,

To the men in my life: a letter about the Orlando shootings, gun violence, Trump, and toxic masculinity


To the men in my life:
Can we have a conversation about the toxic masculinity of mass shooters in the United States, and about what role you, personally, want to play in challenging the harmful side of masculine gender roles?

Can you all make it a point to talk to each other about your feelings?

Can you all make it a point to talk to each other about your relationships (how your dates are going, how you’re going about it)?

Can you all make it a point to talk about being good role models, both privately (1 on 1), semi-privately (hanging out with other guys), and publicly (online by writing and talking [3], offline by giving talks and holding discussions), for other men?

To all:
Instead of talking about how mass shooters are crazy and we should improve mental health care (which should be f***g’ obvious), let’s also talk about how so many of them had a history of domestic violence in their life, how many frequented virulently misogynistic websites long before they got around to shooting people up.

Let’s talk about how the UCLA shooter, who shot his estranged wife before driving to UCLA (3 dead):

Let’s talk about how normal he was. in his note he asked for the police to feed his cat and gave his address. When the police went to his house, they also found a kill list with Hasti’s name on it.

“Hasti’s body was found dead at 1:25 a.m. Thursday, according to the Hennepin County Medical Examiner’s Office. She had multiple gunshot wounds.”

Let’s talk about the Colorado Planned Parenthood shooter and how, according to his ex-wife when filing for divorce (3 dead),
“He’d … suddenly explode in anger at home, kicking her and pulling her hair.” [1]

Let’s talk about how the Orlando shooter beat his wife, years before shooting up 100+ people at a gay nightclub’s Latin Night during Pride Mont (49 dead):
“He beat me. He would just come home and start beating me up because the laundry wasn’t finished or something like that.” [2]

Let’s talk about the UC Santa Barbara shooter (6 dead):
“I’m 22 years old and I’m still a virgin … I don’t know why you girls aren’t attracted to me, but I will punish you all for it. … I don’t know what you don’t see in me. I’m the perfect guy and yet you throw yourselves at these obnoxious men instead of me, the supreme gentleman.”

Let’s talk about the , a 48-year-old systems analyst (4 dead):
“Why do this?? To young girls? Just read below. … Result is I am learning basics by trial and error in my 40s, followed by discuragement. Too embarassed to tell anyone this, at almost 50 one is expected to just know these things. … I was reading several posts on different forums and it seems many teenage girls have sex frequently. One 16 year old does it usually three times a day with her boyfriend. So, err, after a month of that, this little hoe has had more sex than ME in my LIFE, and I am 48.”


Let’s talk about how “women are 11 times more likely to be murdered with guns in the U.S. than in other developed countries.”

Let’s talk about how, “despite impressions from media coverage, mass shootings in which at least four people were murdered with a gun are also typically acts of domestic or family violence:
an Everytown analysis of every mass shooting between 2009-15 found that 57 percent were committed by intimate partners or family.”

Let’s talk about how 90%+ of mass murderers are men.

And let’s address it, one conversation at a time, in real life.

Talk to the men in your life, and expect more of them.

[1] And finally, finally, can we talk about how popular Trump is, despite (or because) he sounds eerily similar to the above men:
” After a painful scalp reduction surgery to remove a bald spot, … Donald held back Ivana’s arms and began to pull out fistfuls of hair from her scalp, as if to mirror the pain he felt from his own operation. He tore off her clothes and unzipped his pants.”

[2] Trump in 1994: “And then I have days where, if I come home — and I don’t want to sound too much like a chauvinist — but when I come home and dinner’s not ready, I go through the roof.””


openCV, ubuntu 14.04, and researching robot portraiture techniques for Robot Art Competition 2016

For the competition, with a ton of help, I’ve gotten a 6 axis arm to work (it accepts x,y,z coordinates).

I configured openCV on ubuntu like so:

(has a few steps tacked onto the official linux installation instructions to hook everything up properly, which is explained on the site and I’ll just make a quick note of below:

sudo gedit /etc/
  • /usr/local/lib
sudo ldconfig
  • PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
  • export PKG_CONFIG_PATH

) (openCV takes up a decent chunk of space!)

I haven’t used C++ before, though I’ve used C. To run some examples, such as this hough transform:

$ g++ houghdemo.cpp -o app `pkg-config --cflags --libs opencv`

This creates a file called “app” which can be run like so:
$ ./app face4.jpg

Man, canny edge detectors on faces look super creepy and not at all recognizable. Also, I don’t think Hough is the way to go for recognizable faces.

Screenshot from 2016-01-14 17:16:26

Alright, so what are some alternative approaches?

stroke-based approach?

I started looking into the general problem of “stroke-based approaches” which will probably be useful later. Here is a good SIGGRAPH paper from 2002 I was skimming through, supplementing with youtube videos when I got confused:

I found this comparison of lines only versus allowing different stroke widths (still one color) very compelling:

It would be interesting to get different stroke widths involved. I wonder what the name of the final photoshop filter (that reduced the image to simple shapes) isInkscape’s vector tracing of bitmaps is (according to the credits) based on Potrace, created by Peter Selinger:

Alright, not quite doing the trick..


Okay, there’s this sweet 2004 paper “Example-Based Composite Sketching of Human Portraits” that Pranjal dug up.

They essentially had an artist generate a training set, then parameterized each feature of the face (eyes, nose, mouth), and had a separate system for the hair. The results are really awesome, but to replicate them, I’d have to have someone dig up 10 year old code and try to get it to run; or generate my own training set, wade into math, and code it all by myself.

Given my limited timeframe (I essentially have two more weeks working by myself), I should probably focus on more artistic and less technical implementations. Yes, the robot has six axis, but motion planning is hard and I should probably focus on an acceptable entry or risk having no entry at all.


An approach that would be slow but would probably capture the likeness better would be to get stippling working. Evil Mad Scientist Labs wrote a stippler in Processing for their egg drawing robot, which outputs an SVG.

Presumably the eggbot software converts the svg to gcode at some point.

If I can’t figure out where there generator is, or want to stick to python, there seems to be PyCAM




First, inspiration. 250 year old writer automaton, you can swap out cams to change the gearing and change what it writes. Crazy!

okay, so more modern. this robot arm uses the Hershey vector fonts to draw kanji.

Turns out there is an open source SVG font for Chinese (Hershey does traditional chinese characters, not simplified) so now I can write messages to my parents :3  if I can convert the svg to commands to the robot.

Haha, there is even a startup that writes notes for you…

Evil mad scientist labs has done some work on the topic.

This seems tractable. The key step seems to be SVG to gcode. Seems like I should be able to roll my own without too much difficulty or else use existing libraries.

misc. videos

^– hi again disney research

impressive with just derpy hobby servos

and of course, mcqueen



hi 2016 (2 servo drawing robot arm, tripod gait 12 servo hexapod, visit to NASA, quadcopter tuning, etc.)

hm, haven’t updated in a while.

i built a lot of robots with parents over the winter break. i built a robot arm and refreshed on inverse kinematics; more specifically, make sure your servos are rotating as you expect: IK goes counterclockwise since angles increase that way, but your servos may increasing in a clockwise direction… a simple map(theta, 0, 180, 180, 0) will fix your problem if you catch it.


processing takes in x,y coordinates drawn on the screen and spits them out to arduino over serial, which does the inverse kinematics and spits out the theta values to the servo

or for the one where it draws what you draw on the screen,

also tried to face.

it does not face well, in part i have derpy three year old code


this processing code takes a lot of processing libraries. thresholds image, performs canny edge detection, then a walking algorithm (look at each black pixel by scanning image in x and y, see if neighbors are black as well, then walk along that pixel) to turn the edges into vectors. then output to robot, but robot is limited in resolution (arduino servo library) and cheap hobby servo overshoot.

below you can see preview in python.  (basic code, I basically copied the output from processing into a text file and  added some python code to that to plot the values)

is to check image is within the working envelope of the arm. IK is fixed with arm “up”.



problem of walking algorithm: adds a box around the image. irritating. need to rewrite code. looking into open cv.

i also rehashed my hexapod project with 12 servos and popsicle sticks


basically this

but modified to work with the servo configuration on the rectangular robot, and added code to allow you to step through the gait with “j” and “k”:

need to implement the other gaits; also, this moves so smoothly, envious, but they have lasercutter :3

worked on quad, now stuck at calibration stage 😡 because i have not built quad before, i could not push through this in a day or two unlike the drawing arm and hexapod.



made from a sad clothes drying rack we took apart





we couldn’t find the original cable for the transmitter, so we connected the ports up with a FTDI -> USB cable as per


used and calibrated my servos to zero… took a while to realize it *can* and *should* read the current values, guess my wires were loose, but the values because a lot easier to input. used the kk2 screen to fix some controls that were reversed from what the kk2 expected (left = left and not right, etc.). zeroed all the values on the kk2. turns out (minus the flipping controls) I could zero just as well on using the trim knobs on the controller itself.

went to visit NASA space museum in houston. they had little robot that made and served you froyo. adorable.


also, some regal looking hexapods in the actual NASA workplace.



at MITERS I got a robot arm working with lots of help from MITERS / London Hackerspace / john from BUILDS. For robot arm competition.

i’m now robot art-ing. here is using Fengrave on a black and white image with appropriate offsets to produce gcode (well, limited to G0 and G1 commands)



face code still derp. (streaks are because i wrote gcode translator, and it goes to x,y,z position instead of x,y and then z). too many x,y points. draws slowly.


michael made crayon extruder (=metal tube + power resistor) and also pen mount. crayons = hard to control flow rate. started making square, then pooped out a lot of melted crayon. alas.


learned a lot of patience dealing with old manuals, 20 year old operating systems / controllers. main issue turned out to be a dumb calibration assumption (robot had arrows; should have ignored them and used indentations instead). gcode -> V+

also, i learned about oscilloscope rs232 decoder! had to invert to get it working properly (zeros are high in rs232?). scope ground, tx line. bam, now you can check whether you are actually transmitting all the carriage return and line feeds you need…


currently: reading up on image processing. openCV.

terse update. more details available if questions exist.

many thanks to my parents for being excited and not jaded