Skip to content

Instantly share code, notes, and snippets.

@shahifaqeer
shahifaqeer / gist:5159005
Created March 14, 2013 05:16
bytes per 10 minutes in UP or DW direction format { [time_10_min_granularity, direction] : total_bytes }
def initialization(self):
...
self.bytesper10minutes = defaultdict(int)
...
def size_stats(self, size, timehash, direction):
# Size distribution overall
self.size_dist[size] += 1
# Bytes per minute and per day
Collected errors:
* satisfy_dependencies_for: Cannot satisfy the following dependencies for luci-app-ahcp:
* ahcpd *
* opkg_install_cmd: Cannot install package luci-app-ahcp.
* satisfy_dependencies_for: Cannot satisfy the following dependencies for luci-app-bismark-passive:
* bismark-passive *
* opkg_install_cmd: Cannot install package luci-app-bismark-passive.
* satisfy_dependencies_for: Cannot satisfy the following dependencies for luci-app-polipo:
* polipo *
* opkg_install_cmd: Cannot install package luci-app-polipo.
@shahifaqeer
shahifaqeer / gist:6134654
Created August 1, 2013 19:55
errors compiling ubus
/homenetworks/quirm-3800/build_dir/target-mips_r2_uClibc-0.9.30.1/ubus-2012-05-05/cli.c
/home/sarthak/homenetworks/quirm-3800/build_dir/target-mips_r2_uClibc-0.9.30.1/ubus-2012-05-05/cli.c: In function 'receive_list_result':
/home/sarthak/homenetworks/quirm-3800/build_dir/target-mips_r2_uClibc-0.9.30.1/ubus-2012-05-05/cli.c:63: error: too many arguments to function 'blobmsg_format_json_with_cb'
cc1: warnings being treated as errors
/home/sarthak/homenetworks/quirm-3800/build_dir/target-mips_r2_uClibc-0.9.30.1/ubus-2012-05-05/cli.c: In function 'receive_call_result_data':
/home/sarthak/homenetworks/quirm-3800/build_dir/target-mips_r2_uClibc-0.9.30.1/ubus-2012-05-05/cli.c:75: error: implicit declaration of function 'blobmsg_format_json_indent'
/home/sarthak/homenetworks/quirm-3800/build_dir/target-mips_r2_uClibc-0.9.30.1/ubus-2012-05-05/cli.c:75: error: assignment makes pointer from integer without a cast
make[5]: *** [CMakeFiles/cli.dir/cli.c.o] Error 1
make[5]: Leaving directory `/home/sarthak/homenetworks/q
@shahifaqeer
shahifaqeer / ubus_compile_errors
Created August 1, 2013 19:56
errors while making ubus package
/homenetworks/quirm-3800/build_dir/target-mips_r2_uClibc-0.9.30.1/ubus-2012-05-05/cli.c
/home/sarthak/homenetworks/quirm-3800/build_dir/target-mips_r2_uClibc-0.9.30.1/ubus-2012-05-05/cli.c: In function 'receive_list_result':
/home/sarthak/homenetworks/quirm-3800/build_dir/target-mips_r2_uClibc-0.9.30.1/ubus-2012-05-05/cli.c:63: error: too many arguments to function 'blobmsg_format_json_with_cb'
cc1: warnings being treated as errors
/home/sarthak/homenetworks/quirm-3800/build_dir/target-mips_r2_uClibc-0.9.30.1/ubus-2012-05-05/cli.c: In function 'receive_call_result_data':
/home/sarthak/homenetworks/quirm-3800/build_dir/target-mips_r2_uClibc-0.9.30.1/ubus-2012-05-05/cli.c:75: error: implicit declaration of function 'blobmsg_format_json_indent'
/home/sarthak/homenetworks/quirm-3800/build_dir/target-mips_r2_uClibc-0.9.30.1/ubus-2012-05-05/cli.c:75: error: assignment makes pointer from integer without a cast
make[5]: *** [CMakeFiles/cli.dir/cli.c.o] Error 1
make[5]: Leaving directory `/home/sarthak/homenetworks/qu
@shahifaqeer
shahifaqeer / web100_userland_error
Created August 5, 2013 22:15
compilation error when making web100_userland package from bismark-package
checking whether ln -s works... yes
checking for python... /data/users/sarthak/build/attitude_adjustment_12.09/staging_dir/host/bin/python
checking for python version... 2.6
checking for python platform... linux2
checking for python script directory... ${prefix}/lib/python2.6/site-packages
checking for python extension module directory... ${exec_prefix}/lib/python2.6/site-packages
checking for Python include path... find: `/data/users/sarthak/build/attitude_adjustment_12.09/staging_dir/host/include/python2.6/': No such file or directory
find: `/data/users/sarthak/build/attitude_adjustment_12.09/staging_dir/host/include/python/': No such file or directory
configure: error: cannot find Python include path
Installing bismark-passive-hasher-tmpfs (HEAD-20) to root...
Installing bismark-passive-http-url-tmpfs (HEAD-20) to root...
Installing bismark-passive-tmpfs (HEAD-20) to root...
Installing bismark-passive-ucap (HEAD-20) to root...
Installing ucap (1-10) to root...
Downloading http://sites.noise.gatech.edu/~sarthak/files/build/bismark-attitude4/packages/ucap_1-10_ar71xx.ipk.
Installing openflow-ucap (HEAD-3) to root...
Downloading http://sites.noise.gatech.edu/~sarthak/files/build/bismark-attitude4/packages/openflow-ucap_HEAD-3_ar71xx.ipk.
Installing veth (1.0-1) to root...
Downloading http://downloads.openwrt.org/attitude_adjustment/12.09/ar71xx/generic/packages/veth_1.0-1_ar71xx.ipk.
@shahifaqeer
shahifaqeer / bismark_attitude_upgrade
Created August 6, 2013 17:03
Instructions to upgrade quirm to recent attitude test build
1. Download the appropriate sysupgrade.bin image from http://sites.noise.gatech.edu/~sarthak/files/build/bismark-attitude4/ based on your netgear router (3700, 3700v2, 3800)
2. Log in to your bismark gateway [myrouter.projectbismark.net or 192.168.142.1 (by default)]. Go to "Systems" -> "Flash/Backup Firmware"
3. Select the sysupgrade.bin image you downloaded and flash the router. Wait till reboot occurs and log in to the router again
4. Bismark experiments running previously can be re-enabled in the "Experiments" tab
5. ssh to your router and change the package sources urls in /etc/opkg.config to:
http://sites.noise.gatech.edu/~sarthak/files/build/bismark-attitude4/packages/
http://sites.noise.gatech.edu/~sarthak/files/build/bismark-attitude4/extra-packages/
http://downloads.openwrt.org/attitude_adjustment/12.09/ar71xx/generic/packages/
6. To install a fresh build of bismark-active, execute opkg -d ram install bismark-active-tmpfs
7. To install a fresh build of bismark-passive without ucap running, exe
@shahifaqeer
shahifaqeer / serverOutages
Created October 9, 2013 21:40
Server outage start and end times from Oct 2010 to April 2013 for heartbeats data.
outage_start_times = [datetime(2012, 10, 10, 6, 45),datetime(2012, 10, 13, 5, 0), datetime(2012, 11, 3, 21, 57),
datetime(2012, 11, 7, 9, 0), datetime(2012, 11, 18, 16, 0), datetime(2012, 12, 18, 16, 45), datetime(2012, 12, 21, 7, 15) ,
datetime(2013, 2, 6, 8, 37, 14),datetime(2013, 2, 12, 14, 29, 7), datetime(2013, 2, 20, 18, 9, 20),datetime(2013, 4, 24, 17, 0) ]
outage_end_times = [datetime(2012, 10, 10, 11, 0), datetime(2012, 10, 13, 6, 30),datetime(2012, 11, 3, 22, 0, 20),
datetime(2012, 11, 7, 10, 0),datetime(2012, 11, 18, 21, 0), datetime(2012, 12, 18, 20, 45), datetime(2012, 12, 21, 9, 15),
datetime(2013, 2, 6, 8, 57, 57), datetime(2013, 2, 14, 16, 48, 19), datetime(2013, 2, 20, 20, 57, 17), datetime(2013, 4, 25, 17, 0)]
@shahifaqeer
shahifaqeer / checkOutage
Created October 9, 2013 21:42
function to check sample timestamp and mark if in outage or not
#For October 1, 2012 to April 30, 2013 - remove all server side outages
def check_outage(a):
exc = 0
#October
if a > datetime(2012, 10, 10, 6, 45) and a < datetime(2012, 10, 10, 11, 0):
exc = 1
if a > datetime(2012, 10, 13, 5, 0) and a < datetime(2012, 10, 13, 6, 30):
exc = 1
#November
#!/bin/sh
A='192.168.10.184'
B='192.168.10.158'
C='192.168.10.142'
R='192.168.10.1'
S='192.168.20.1'
echo "usage on machine A: sh pingall.sh 'A'"