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 / gist:8c46690f2b7414e6d522
Last active August 29, 2015 14:21
Convert images to PDF in order of filename, with text prefix and numerical suffix, such as Untitled-0.jpg, Untitled-1.jpg, etc.
ls tap1/*.jpg | sort -t- -nk2,2 | tr '\n' ' ' | sed 's/$/\ tap1.pdf/' | xargs convert
@stevenvo
stevenvo / a.rb
Created June 29, 2015 18:36
Hitachi-3TB-HDD-Smartctl
ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE
1 Raw_Read_Error_Rate 0x000b 100 100 050 Pre-fail Always - 0
2 Throughput_Performance 0x0005 100 100 050 Pre-fail Offline - 0
3 Spin_Up_Time 0x0027 100 100 001 Pre-fail Always - 11769
4 Start_Stop_Count 0x0032 100 100 000 Old_age Always - 18
5 Reallocated_Sector_Ct 0x0033 100 100 050 Pre-fail Always - 0
7 Seek_Error_Rate 0x000b 100 100 050 Pre-fail Always - 0
8 Seek_Time_Performance 0x0005 100 100 050 Pre-fail Offline - 0
9 Power_On_Hours 0x0032 097 097 000 Old_age Always - 1512
10 Spin_Retry_Count 0x0033 100 100 030 Pre-fail Always - 0
@stevenvo
stevenvo / dd.cmd
Last active August 29, 2015 14:24
dd command
dd bs=4M if=2014-09-09-wheezy-raspbian.img | pv | dd of=/dev/mmcblk0
Stevens-MBP:src stevenvo$ python recognize_faces.py
../data/training/01-Tracy-Cropped
../data/training/02-Trish-Cropped
../data/training/03-Steven-Cropped
Traceback (most recent call last):
File "recognize_faces.py", line 51, in <module>
generate_eigenfaces()
File "recognize_faces.py", line 45, in generate_eigenfaces
compute_pca(X_train, y_train)
File "recognize_faces.py", line 37, in compute_pca
@stevenvo
stevenvo / numpy-array-sort.py
Last active March 16, 2021 08:23
Sort array by nth column in Numpy
# sort array with regards to nth column
arr = arr[arr[:,n].argsort()]
@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
@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 / 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 / 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 / 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