User:DBrant (WMF)/Goodies

Jump to navigation Jump to search

Uncle Dmitry's bag of goodies. You're welcome.

Apps team pages[edit]

Plans and goals[edit]

Phabricator boards[edit]



$ brew install jd-gui
$ brew install dex2jar
$ d2j-dex2jar <input.dex> -o <output.jar>
$ adb tcpip 5555
$ adb connect <ip-address>:5555
  • To switch back to ADB over USB:
$ adb -s <ip-address>:5555 usb
  • To get the IP address of the device:
$ adb shell
$ netcfg
  • To simulate a BOOT_COMPLETED event:
$ adb shell
$ am broadcast -a android.intent.action.BOOT_COMPLETED

The above may actually cause your device to reboot, in which case you'll get the event when the device finished booting! ;)

  • To simulate an INSTALL_REFERRER event:
$ adb shell
$ am broadcast -a -n org.wikipedia/ --es "referrer" ""

In the above, make sure you set the package name ("org.wikipedia") to the correct flavor that you're testing, and optionally change the "referrer_url" to something else.

  • To examine the fingerprints of the signing key that was used to sign an APK (the keytool executable is found in the JDK folder):
$ keytool.exe -list -printcert -jarfile [filename].apk


  • Linux/Windows/Mac: MySQL Workbench
    • (Windows only) Establish an ssh tunnel to stat1006: $ ssh -L 222:localhost:22 stat1006.eqiad.wmnet (note the port number "222", so that it doesn't conflict with any local SSH server that might be running)
    • SSH Hostname: localhost, SSH Username: dbrant, MySQL Hostname: analytics-slave.eqiad.wmnet, Username: research
    • Get the password for the "research" user from stat1006/etc/mysql/conf.d/research-client.cnf.
    • Note, when installing on Windows, and you find that Workbench fails to connect to Wikimedia's stat1006 over the Bastion tunnel, try using this fork of paramiko.
    • Also, to make text fields appear properly, go to Edit -> Preferences, SQL Editor -> SQL Execution, and check the box "Treat BINARY/VARBINARY as nonbinary character string."
  • Mac only: Sequel Pro
    • MySQL Host: analytics-slave.eqiad.wmnet, Username: research, SSH Host: stat1006.eqiad.wmnet
    • Get the password for the "research" user from stat1006/etc/mysql/conf.d/research-client.cnf.

Gerrit / Github repos[edit]

Git Review workflow[edit]

When modifying/amending an existing patch:

git review -d [changenumber]

...make changes...

git commit --all --amend

git review -R


$ git remote add upstream
$ git fetch upstream
$ git checkout master
$ git merge upstream/master






Running locally:

CI / Jenkins / Zuul[edit]

  • Main Jenkins dashboard.
  • Search of the dashboard for everything about "apps"
  • Add a comment of "recheck" to force Jenkins to reevaluate a patch.

Remember to always !log in #wikimedia-qa when performing manual commands via Jenkins control panel.

Wikitech / OpenStack / Cloud services[edit]

  • After creating an account, make sure to upload your public key.
  • Deployment-prep project, where new tools and experimental features are hosted before going to production. (Hosts testing eventlogging server, among other things.)
  • Mobile project. (Hosts android-builder, among other things)
  • List of all projects.
  • Nova Resource category.

Event logging[edit]

$ ssh deployment-eventlog05.eqiad.wmflabs
$ tail -f /srv/log/eventlogging/all-events.log | grep "MobileWikiApp"


  • SWAP: Python notebooks integrated into eventlogging.

releases1001 (releases) (formerly Bromine, formerly Caesium)[edit]

To copy stuff over:

$ scp [file] releases1001.eqiad.wmnet:~/[file]
$ scp app.apk releases1001.eqiad.wmnet:/srv/org/wikimedia/releases/mobile/android/wikipedia/alphas/app.apk

Android builds[edit]

  • New:
    • Gerrit repository that contains the web page that serves the Alpha download link, and the shell script that copies the latest Alpha from the CI server to the web server. After committing a change to this repo, log on to the android-builder server, and do a git pull on /srv/builds.
$ ssh
$ sudo -s
$ sudo -u android-build /bin/bash
$ cd /srv/builds
$ ssh
$ OR: ssh
$ become wikipedia-android-builds
$ webservice [start|stop]




Bintray / Maven / Jcenter[edit]

Wmflabs Android maven repo[edit]

$ ssh
$ cd /data/project/android-maven-repo/public_html

.ssh config[edit]

## Use as proxy to labs
Host bastlabs
User dbrant
IdentityFile ~/.ssh/id_rsa

Host *.eqiad.wmflabs !
User dbrant
IdentityFile ~/.ssh/id_rsa
ProxyCommand ssh -a -W %h:%p bastlabs

## Production bastion host
Host bastprod
User dbrant
IdentityFile ~/.ssh/id_rsa_prod

Host *.eqiad.wmnet * !
User dbrant
IdentityFile ~/.ssh/id_rsa_prod
ProxyCommand ssh -a -W %h:%p bastprod

Notice that the above file uses a different key file for production than wmflabs, for security reasons.

On macOS 10.12 and above, you may need to add the following (since it no longer adds the keys to ssh-agent by default):

Host *
UseKeychain yes
AddKeysToAgent yes





 mogrify -format jpg -quality 90 *.png
  • Convert a batch of PNG images to JPG, and resize to thumbnail:
 mogrify -format jpg -quality 90 -thumbnail 512 *.png
  • Encode an Exif date tag into photos (recursively, in a whole directory):
 exiftool -AllDates-= -AllDates="2008:01:01 12:00:00" -overwrite_original -r .
  • Remove the GPS Exif tag from photos:
 exiftool -gps:all= -xmp:geotag= image.jpg -overwrite_original *
  • Add Copyright tag to all JPG images in directory:
 exiftool *.jpg -Copyright="Copyright (c) Dmitry Brant."
  • Create video (x264) from a series of still frames (png):
 ffmpeg -r 60 -f image2 -s 600x360 -start_number 0 -i frame%d.png -vcodec libx264 -crf 18 -pix_fmt yuv420p test.mp4
 (-r = frame rate, -crf = quality (lower is better))
  • Convert (cross map) a genomic file (BAM) from one reference genome to another:
 python bam hg19ToHg38.over.chain WGC074699D_combined.chr17.bam chr17.bam
 ./otf2bdf -p 10 -r 96 -o font.bdf font.ttf
 (-p = font size, -r = screen dpi)

Teachable moments[edit]