Skip to content

Instantly share code, notes, and snippets.

@alotaiba
alotaiba / Arduino TCP Server
Created January 24, 2011 16:14
A simple TCP server written in Python to control the Arduino board, it receives the signals over TCP connection, and sends them to the Arduino board using serial.
#!/usr/bin/env python
#
# Copyright 2011 Abdulrahman Alotaiba
# http://www.mawqey.com/
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
@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:913313
Created April 11, 2011 10:06
Using rsync to sync files to an Amazon EC2 instance using SSH key
rsync -avz /path/to/local/sync/folder -e "ssh -i /path/to/ssh/key" ubuntu@ec2instance:/path/to/remote/sync/folder
@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 / 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 / Linux-Commands.md
Created June 18, 2011 18:13
Linux commands cheat sheet

Linux Commands

@alotaiba
alotaiba / channels.md
Created June 18, 2011 19:22
List of TV channels that support m3u8 format a.k.a http live streaming