This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This gist is used to batch download thumbnails for YouTube videos. | |
# You must create a txt file that includes a list of video IDs (one per line). | |
# | |
# To get the IDs for your videos: | |
# 1. Goto: https://www.youtube.com/my_videos | |
# 2. Open a JS Console | |
# 3. Run: var o="";var v=document.getElementsByClassName("vm-video-title-container");for(var i in v){o+=v[i].id.replace("title_","")+"\n";} | |
# 4. The variable "o" contains a string with all the IDs, type "o" to print it. | |
# 5. Copy the IDs into a text file (one per line) | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
This code relies on the fact that PORTB on the ATMega328 chip has consecutive pins | |
which we can take advantage of to set the channel on the mux. | |
This code has been tested with Sparkfun's 16-ch mux (https://www.sparkfun.com/products/9056). | |
*/ | |
#define MUX_CH_COUNT 16 // Reduce this number if you use less channels | |
#define PIN_D_MUX_S0 8 // bit 7 of PORTB | |
#define PIN_D_MUX_S1 9 // bit 6 of PORTB |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Arduino's random() function repeats when the program resets. | |
The typical solution is to seed it with a floating analog pin reading. | |
The problem with that is that the analog pin is not really random either | |
so you still end up with sequences that repeat fairly frequently. It also | |
requires you to give up an analog pin. | |
This gist attempts to solve these problems by storing the previous seed | |
in EEPROM and incrementing it each time the program resets. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
BOIFS=$IFS | |
IFS=$'\n' | |
echo "Possible unused functions:" | |
for line in `ack -h --ruby 'def .*' | sed 's/ //g'`; do | |
function_name=${line#def*} | |
function_name=${function_name#self.*} | |
function_name=${function_name%(*} | |
num_matches=`ack -c -h $function_name | sed 's/ //g'` | |
if [ "$num_matches" -lt 2 ] |