Skip to content

Instantly share code, notes, and snippets.

View stevenvo's full-sized avatar

Steven Vo stevenvo

  • GeoComply
  • Bay Area
View GitHub Profile
@stevenvo
stevenvo / setup_rmate.md
Last active January 27, 2016 21:31
Remote TextMate

Install rmate on remote server that stores the files for editing

gem install rmate (you may need to add sudo)

SSH into the remote server using this syntax

ssh -R 52698:localhost:52698 pi@192.168.1.186 (change the username@host accordingly)

inside remote server, run rmate

@stevenvo
stevenvo / grep.sh
Last active October 25, 2015 23:57
Search files for specific content
Do the following:
grep -rnw '/path/to/somewhere/' -e "pattern"
grep --exclude=\*.{o,a,.so} -rnw '.' -e "msse"
-r or -R is recursive, -n is line number and -w stands match the whole word. -l (letter L) can be added to have just the file name.
Along with these, --exclude or --include parameter could be used for efficient searching. Something like below:
@stevenvo
stevenvo / dd.sh
Created October 19, 2015 23:30
DD raspberry pi image onto SD card
diskUtil unmountDisk /dev/disk2
sudo dd bs=1m if=2015-01-31-raspbian_x300.img of=/dev/rdisk2
@stevenvo
stevenvo / gpg_error.sh
Last active February 8, 2016 20:58
GPG error - NO_PUBKEY
If you encounter this error while `sudo apt-get update` on Debian
W: GPG error: http://ftp.debian.org experimental Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 8B48AD6246925553 NO_PUBKEY 7638D0442B90D010
_Solution_
$ gpg --keyserver pgpkeys.mit.edu --recv-key 8B48AD6246925553
$ gpg -a --export 8B48AD6246925553|sudo apt-key add -
$ gpg --keyserver pgpkeys.mit.edu --recv-key 7638D0442B90D010
$ gpg -a --export 7638D0442B90D010|sudo apt-key add -
@stevenvo
stevenvo / record.sh
Created October 4, 2015 22:40
record stereo, mono with arecord, and read with pocketsphinx
# Stereo record - dual channels
arecord -f cd -D plughw:1,0 -d 20 test.wav
# Mono - single channel
arecord -f S16_LE -D plughw:1,0 -d 20 -r 16000 test.wav
#read
pocketsphinx_continuous -samprate 16000/8000/48000 -infile test.wav
@stevenvo
stevenvo / 0_reuse_code.js
Last active August 25, 2015 22:44
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@stevenvo
stevenvo / numbering-header.css
Created August 10, 2015 20:53
Numbering header CSS
body {counter-reset: h2}
h2 {counter-reset: h3}
h3 {counter-reset: h4}
h4 {counter-reset: h5}
h5 {counter-reset: h6}
h2:before {counter-increment: h2; content: counter(h2) ". "}
h3:before {counter-increment: h3; content: counter(h2) "." counter(h3) ". "}
h4:before {counter-increment: h4; content: counter(h2) "." counter(h3) "." counter(h4) ". "}
h5:before {counter-increment: h5; content: counter(h2) "." counter(h3) "." counter(h4) "." counter(h5) ". "}
h6:before {counter-increment: h6; content: counter(h2) "." counter(h3) "." counter(h4) "." counter(h5) "." counter(h6) ". "}
@stevenvo
stevenvo / wifi-password-retrieve.sh
Created August 10, 2015 10:01
How to find Wi-Fi Network passwords on your Mac
$ security find-generic-password -ga "YourWifiNameHere" | grep "password:"
@stevenvo
stevenvo / imgur-screenshot.sh
Created August 5, 2015 23:55
SH script to screenshot & upload to Imgur (or taking from clipboard if using Snagit)
#!/bin/bash
# https://github.com/jomo/imgur-screenshot
# https://imgur.com/apps
current_version="v1.5.4"
function is_mac() {
uname | grep -q "Darwin"
}
@stevenvo
stevenvo / week-2-result.py
Last active August 29, 2015 14:26
cs596-029-week-2-report
$ python recognize_faces.py
======LOAD TRAINING DATA=======
- Mode, id, name, total images: training, 01, Tracy, 162
- Mode, id, name, total images: training, 02, Trish, 68
- Mode, id, name, total images: training, 03, Steven, 64
======LOAD TESTING DATA=======
- Mode, id, name, total images: testing, 00, friends, 0
- Mode, id, name, total images: testing, 01, Tracy, 28