Skip to content

Instantly share code, notes, and snippets.

import argparse
import requests
import logging
#logging.basicConfig(level=logging.DEBUG)
# Instantiate the parser
parser = argparse.ArgumentParser(description='Testing robot federation')
parser.add_argument('action', type=str,
import psycopg2
import psycopg2.extras
HOST = "localhost"
PASSWORD = "password"
conn = psycopg2.connect(host=HOST, user="clair", password=PASSWORD, database="clair", port="5432")
print("Database opened successfully")
cur = conn.cursor(cursor_factory=psycopg2.extras.DictCursor)
yum install wget openssl-devel python-six python-sphinx gcc make python-devel openssl-devel kernel-devel graphviz kernel-debug-devel autoconf automake rpm-build redhat-rpm-config libtool python-twisted-core python-zope-interface PyQt4 desktop-file-utils libcap-ng-devel groff checkpolicy selinux-policy-devel -y
useradd ovs
su - ovs
mkdir -p ~/rpmbuild/SOURCES
wget http://openvswitch.org/releases/openvswitch-2.9.2.tar.gz
cp openvswitch-2.9.2.tar.gz ~/rpmbuild/SOURCES/
tar xfz openvswitch-2.9.2.tar.gz
#!/bin/bash
LOCAL_IP=$(hostname -i)
REMOTE_IP=$1
LOCAL_TUNNEL_IP=$2
REMOTE_TUNNEL_IP=$3
display_usage() {
echo -e "\nUsage: $0 [remote ip address] [local tunnel ip] [remote tunnel ip] \n"
}
@syed
syed / timing.py
Created June 7, 2016 17:48
Simple script which calculates time spent in a function. The function which is being timed should be decorated with @timing. Keeps track of stack, if children have an @timing, they are also included in the output
timing_indent = -1
call_graph = list()
def timing(f):
def wrap(*args, **kwargs):
global timing_indent
global call_graph
timing_indent += 1
@syed
syed / aes_cbc_pkcs5_b64.go
Last active December 12, 2022 10:11
This simple program is to demonstrate encryption and decryption in golang using AES CBC with PKCS5Padding
package main
import (
"bytes"
"crypto/aes"
"crypto/cipher"
b64 "encoding/base64"
"errors"
"fmt"
"log"
import requests
import sys
import json
import urllib
import graphitesend
from docopt import docopt
"""
Usage:
sfmetrics.py --sf_host=<sf_host> --sf_user=<sf_user> --sf_password=<sf_password> --graphite_host=<graphite_host> --interval=<interval>
@syed
syed / docker_io_limt.py
Created June 9, 2015 21:11
Simple python script to limit I/O bandwidth of a container
#!/bin/python
"""
This script uses cgroups to limit a docker container's read/write bandwidth
Usage:
limit_docker_io.py <container_id> --read=<read_bps> --write=<write_bps>
Options:
--read=<read_bps> Read bps 0 for unlimited [default: 0]
@syed
syed / tb_model.ipynb
Created July 9, 2013 18:26
Example use of pandas
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@syed
syed / tent_reminder.js
Created September 13, 2012 02:49
This is a simple on[x] script that I wrote to remind my friend to bring tent, sleeping bag and anti leech powder for our trek
// Initializing variables
var message = "Tent + Sleeping bag le kar aana aur agar aapke paas " +
"anti leech hai woh jo powder etc woh be le kar aana";
var contact = { name : "Dhiraj",phoneNumber : "+91123456789" } ;
var msg_time = new Date(2012,8,12,8,0,0,0); // Date(year, month, day, hours, minutes, seconds, milliseconds);
var msg_time_ms = msg_time.getTime();
// End of variables initializing