Skip to content

Instantly share code, notes, and snippets.

@boostrack
boostrack / upgrade_ovs_in_mininet.sh
Created April 9, 2016 18:02 — forked from subh007/upgrade_ovs_in_mininet.sh
Installing new version of Open vSwitch 2.3.0 use Mininet
#!/bin/sh -ev
# Reference: https://github.com/mininet/mininet/wiki/Installing-new-version-of-Open-vSwitch
# How to test: ovs-vsctl -V
# Check permission
test $(id -u) -ne 0 && echo "This script must be run as root" && exit 0
#Remove old version ovs
aptitude remove openvswitch-common openvswitch-datapath-dkms openvswitch-controller openvswitch-pki openvswitch-switch -y
@boostrack
boostrack / rest_app.py
Created April 9, 2016 18:02 — forked from subh007/rest_app.py
This is firewall udp firewall application.- Drop all the udp packets.- Allow all the other traffic.
import requests
from requests.auth import HTTPBasicAuth
from websocket import create_connection
"""
Executing the file:
$ python rest_app.py (edit the BASEURL according to the controller ip (address, port))
Steps to follow to test the code:
@boostrack
boostrack / install.sh
Last active December 3, 2015 09:35 — forked from wdullaer/install.sh
Install Latest Docker and Docker-compose on Ubuntu
# Ask for the user password
# Script only works if sudo caches the password for a few minutes
#sudo true
## Install kernel extra's to enable docker aufs support
#sudo apt-get -y install linux-image-extra-$(uname -r)
## Add Docker PPA and install latest version
#sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
#sudo sh -c "echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list"
@boostrack
boostrack / docker-cleanup
Created December 3, 2015 09:26 — forked from wdullaer/docker-cleanup
Cleanup unused Docker images and containers
#!/bin/sh
# Cleanup docker files: untagged containers and images.
#
# Use `docker-cleanup -n` for a dry run to see what would be deleted.
untagged_containers() {
# Print containers using untagged images: $1 is used with awk's print: 0=line, 1=column 1.
# NOTE: "[0-9a-f]{12}" does not work with GNU Awk 3.1.7 (RHEL6).
# Ref: https://github.com/blueyed/dotfiles/commit/a14f0b4b#commitcomment-6736470
docker ps -a | tail -n +2 | awk '$2 ~ "^[0-9a-f]+$" {print $'$1'}'
@boostrack
boostrack / rename p128p1 to eth0
Created October 21, 2015 20:30
rename p128p1 to eth0
sudo INTERFACE=p128p1 MATCHADDR=$(ip addr show $INTERFACE | grep ether | awk '{print $2}') /lib/udev/write_net_rules
http://www.hellovinoth.com/ubuntu-14-04-renaming-ethernet-interfaces-from-p1p1%E2%80%B3-to-eth0%E2%80%B3/
Here’s how to rename your network card in Ubuntu 14.04:
Get your ethernet card MAC address: ifconfig | grep HWaddr
keep it handy (open a new Terminal window for following steps)
cd /etc/udev/rules.d
backup your file: cp 70-persistent-net.rules 70-persistent-net.rules.bak
edit your file: sudo nano 70-persistent-net.rules
@boostrack
boostrack / pr.md
Created October 2, 2015 15:01 — forked from piscisaureus/pr.md
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = [email protected]:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@boostrack
boostrack / packer-aws-ami-template.json
Last active September 22, 2015 12:21 — forked from sumeetpareek/packer-aws-ami-template.json
packer template to create aws ami using ansible provisioner
{
"variables": {
"aws_access_key": "", // This helps me connect to AWS
"aws_secret_key": ""
},
"builders": [{
"type": "amazon-ebs",
"access_key": "{{user `aws_access_key`}}",
"secret_key": "{{user `aws_secret_key`}}",
"region": "us-east-1",
@boostrack
boostrack / LambdaPi.java
Last active September 21, 2015 07:15 — forked from thomasdarimont/LambdaPi.java
Approximate PI in almost one line with Lambdas in Java 8 :) - Theory here: http://www.stealthcopter.com/blog/2009/09/python-calculating-pi-using-random-numbers/
package de.tutorials.training.java8.lambda;
import java.util.stream.IntStream;
import static java.lang.Math.*;
import static java.util.concurrent.ThreadLocalRandom.*;
/**
* Author: Thomas Darimont
*/
@boostrack
boostrack / Example of SVG sprites.markdown
Last active September 14, 2015 09:48
Example of SVG sprites
@boostrack
boostrack / .gitignore
Last active August 29, 2015 14:20 — forked from meeDamian/.gitignore
# PROJECT `.gitignore`
# put it in the *root* of your project
# most likely just append this line to the already existing file
/secret.properties