Skip to content

Instantly share code, notes, and snippets.

@alotaiba
alotaiba / Arduino LED graph bar sketch
Created January 24, 2011 16:20
Arduino LED graph bar sketch, which receives the signals from serial port.
const int baudRate = 9600;
const int ledCount = 10;
int ledPins[] = { 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 };
char msg = ' ';
void setup() {
// loop over the pin array and set them all to output:
for (int thisLed = 0; thisLed < ledCount; thisLed++) {
pinMode(ledPins[thisLed], OUTPUT);
@alotaiba
alotaiba / gist:913308
Created April 11, 2011 10:01
How to encode images to base64 for HTML using openssl
# Credit goes to Marcel http://narings.net/blog/archives/4
echo "<img src=\"data:image/png;base64,`openssl base64 -in img.png | tr -d '\n\'`\">" > page.html
@alotaiba
alotaiba / gist:913324
Created April 11, 2011 10:21
Converting Apple's certificates from .p12 to .pem format
openssl pkcs12 -in secret_file.p12 -out secret_file.pem -nodes -clcerts
@alotaiba
alotaiba / gist:913329
Created April 11, 2011 10:26
Opening Chromium/Chrome with a custom user agent (iPhone)
open Chromium.app --args -user-agent="Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A293 Safari/6531.22.7"
@alotaiba
alotaiba / Favorite Podcasts.markdown
Created May 14, 2011 20:34
My Favorite Podcasts
@alotaiba
alotaiba / channels.md
Created June 18, 2011 19:22
List of TV channels that support m3u8 format a.k.a http live streaming
@alotaiba
alotaiba / natvpn.sh
Created June 18, 2011 18:01
This script is to turn on/off NATting through to a VPN server on Mac.
#!/bin/bash
# This script to turn on/off NATting through to a VPN server.
# Example would be turning the mac into a wireless router, and routing all the incoming
# traffic to the VPN server.
# Thanks to http://rodrigo.sharpcube.com/2010/06/20/using-and-sharing-a-vpn-connection-on-your-mac/
case "$1" in
on)
echo "Turning NAT VPN on."
natd -interface tun0
@alotaiba
alotaiba / screen.txt
Created February 3, 2012 06:45
Some useful screen commands for Linux (to run background processes)
# Some useful screen commands for Linux (to run background processes)
## Starting a new screen with title
screen -t <title_of_screen>
## Resuming screen
screen -r
## Starting a screen with a command
screen -dmS <title_of_screen> <command_to_run>
@alotaiba
alotaiba / ffmpeg_commands.txt
Created February 3, 2012 06:36
Useful ffmpeg commands for manipulating voice
# Useful ffmpeg commands for manipulating voice
# Convert from mic to FLAC with bitrate = 96kbps, hw:0,0 refers to the mic, it could be different for your machine
ffmpeg -f alsa -ar 16000 -ac 2 -i hw:0,0 -acodec flac -ab 96k <output_file_name>
# Convert from raw PCM 16bit LE to FLAC with sample rate (frequency) = 16khz, with bitrate = 96kbps
ffmpeg -f s16le -ar 16000 -i <input_file_name> -acodec flac -ar 16000 -ab 96k <output_file_name>
@alotaiba
alotaiba / empty_branch.md
Created February 6, 2012 19:57
How To Create Empty Branch To Store Other Files

How To Create Empty Branch To Store Other Files

Sometimes, it's useful to create a branch that doesn't contain the main files, for example, to store other related files to the project, such as, media files, PSD, etc.

This procedure was taken from gh-pages
http://pages.github.com/

$ cd /path/to/repo
$ git symbolic-ref HEAD refs/heads/<branch_name>

$ rm .git/index