Skip to content

Instantly share code, notes, and snippets.

@alotaiba
alotaiba / grab_gists.rb
Created February 19, 2012 23:13
Simple ruby script that fetches all github gists that belong to an authenticated user
#!/usr/bin/env ruby
## Grab Gists
## Copyright (c) Abdulrahman Saleh Khamis Alotaiba
## Licensed under BSD
##
## This is a simple ruby script that fetches all github gists
## that belong to the authenticated user, which is defined
## in GITHUB_USER variable, along with its password GITHUB_PASSWORD
##
@alotaiba
alotaiba / list_open_ports.md
Created February 8, 2012 08:49
Listing Open Ports That Are Listening for Incoming Connection

Listing Open Ports That Are Listening for Incoming Connection

$ sudo lsof -i -P | grep -i "listen"

@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

@alotaiba
alotaiba / google_speech2text.md
Created February 3, 2012 13:20
Google Speech To Text API

Google Speech To Text API

Base URL: https://www.google.com/speech-api/v1/recognize
It accepts POST requests with voice file encoded in FLAC format, and query parameters for control.

Query Parameters

client
The client's name you're connecting from. For spoofing purposes, let's use chromium

lang
Speech language, for example, ar-QA for Qatari Arabic, or en-US for U.S. English

@alotaiba
alotaiba / google_text2speech.md
Created February 3, 2012 07:31
Google Text to Speech API

Google Text to Speech API

Base URL: http://translate.google.com/translate_tts
It converts written words into audio. It accepts GET requests.

GET

q
The query string to convert to audio

tl
Translation language, for example, ar for Arabic, or en-us for English

@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 / channels.md
Created June 18, 2011 19:22
List of TV channels that support m3u8 format a.k.a http live streaming
@alotaiba
alotaiba / Linux-Commands.md
Created June 18, 2011 18:13
Linux commands cheat sheet

Linux Commands

@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