Skip to content

Instantly share code, notes, and snippets.

View mohamed-ahmed's full-sized avatar

Mohamed Ahmed mohamed-ahmed

View GitHub Profile
@mohamed-ahmed
mohamed-ahmed / get_usb_ip_address.sh
Created June 16, 2014 22:48
Get ip address of usb0 device (Linux)
ifconfig | grep usb -1 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'
//windows
[
//ctrl+i to indent lines properly like in eclipse (Windows)
{ "keys": ["ctrl+i"], "command": "reindent" }
]
//macosx
[
//ctrl+i to indent lines properly like in eclipse (Mac OSX)
{ "keys": ["super+i"], "command": "reindent" }
@mohamed-ahmed
mohamed-ahmed / static_server.js
Last active August 29, 2015 14:00
Small block of code to serve static files using node (useful for debugging when "XMLHttpRequest cannot load file..")
var express = require('express');
var app = express();
var path = require('path');
app.get('/', function(req, res) {
res.sendfile('index.html');
});
app.use(express.static(path.join(__dirname, '/')));
var q= function(s){ return document.getElementById(s) }
function send(){
var input = q('text');
socket.send(input.value);
input.value = '';
}
var socket = new io.Socket(null, {
port: 8001,