Skip to content

Instantly share code, notes, and snippets.

View samos123's full-sized avatar
🎯
Focusing

Sam Stoelinga samos123

🎯
Focusing
View GitHub Profile
@samos123
samos123 / shadowsocks.conf
Created October 18, 2014 12:19
shadowsocks upstart job
start on filesystem
stop on runlevel [016]
exec /usr/local/bin/sslocal -qq -c /etc/shadowsocks.json --fast-open
@samos123
samos123 / heat_vm_boot_from_volume.yaml
Created October 31, 2014 09:20
A heat template which creates a vm booted from a cinder volume that contains the image
heat_template_version: 2013-05-23
description: >
A HOT template that holds a VM instance booted from Volume where the image
is copied to the volume automatically. The VM does nothing, it is only created.
parameters:
key_name:
type: string
description: Name of an existing key pair to use for the instance
@samos123
samos123 / vboxhostonly_nat_router.sh
Created November 2, 2014 02:47
Giving a host only virtualbox network internet access by making the vboxhost a natted router
#!/bin/bash
network_with_inet_access=wlan0
private_natted_network=vboxnet1
sudo iptables -t nat -A POSTROUTING -o $network_with_inet_access -j MASQUERADE
sudo iptables -A FORWARD -i $private_natted_network -o $network_with_inet_access -m state --state RELATED,ESTABLISHED -j ACCEPT
sudo iptables -A FORWARD -i $private_natted_network -o $network_with_inet_access -j ACCEPT
@samos123
samos123 / vocore_config_network
Created November 13, 2014 09:09
vocore wan dhcp , lan wifi configuration
config interface 'loopback'
option ifname 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'
config globals '
## This is from neutron port-show command
neutron port-show e5e3906b-24d8-4642-9876-2ac06f984809
+-----------------------+--------------------------------------------------------------------------------------+
| Field | Value |
+-----------------------+--------------------------------------------------------------------------------------+
| admin_state_up | True |
| allowed_address_pairs | |
| binding:host_id | node-7 |
| binding:profile | {} |
@samos123
samos123 / gist:885f9fe87c8fa5abf78f
Created May 28, 2015 15:29
spark-extract-sift-features.py
from __future__ import print_function
import sys
import os
import cv2
import numpy as np
def extract_sift_features_opencv(imgfile_imgbytes):
@samos123
samos123 / gist:3300191684aee7fc8013
Created May 28, 2015 15:31
full stderr log of spark worker
Using Spark's default log4j profile: org/apache/spark/log4j-defaults.properties
15/05/28 15:16:22 INFO CoarseGrainedExecutorBackend: Registered signal handlers for [TERM, HUP, INT]
15/05/28 15:16:23 WARN NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
15/05/28 15:16:23 INFO SecurityManager: Changing view acls to: hdfs
15/05/28 15:16:23 INFO SecurityManager: Changing modify acls to: hdfs
15/05/28 15:16:23 INFO SecurityManager: SecurityManager: authentication disabled; ui acls disabled; users with view permissions: Set(hdfs); users with modify permissions: Set(hdfs)
15/05/28 15:16:24 INFO Slf4jLogger: Slf4jLogger started
15/05/28 15:16:24 INFO Remoting: Starting remoting
15/05/28 15:16:24 INFO Remoting: Remoting started; listening on addresses :[akka.tcp://driverPropsFetcher@vagrant-ubuntu-trusty-64.localdomain:33398]
15/05/28 15:16:24 INFO Utils: Successfully started service 'driverPropsFetcher' on port 33398.
@samos123
samos123 / gist:d383c26f6d47d34d32d6
Created May 30, 2015 13:20
tests.py for feature_extraction on spark
import unittest
import feature_extraction
class FeatureExtractionTest(unittest.TestCase):
def test_extract_opencv_sift(self):
imgbytes = bytearray(open("img.jpg", "rb").read())
result = feature_extraction.extract_sift_features_opencv(("testfilename.jpg", imgbytes))
print result
#!/bin/bash
if [ $# -ne 2 ]; then
echo "Usage: $0 \$ssid \$passphrase";
exit 1;
fi
wifi_device=wlp3s0
ssid=$1
passphrase=$2
@samos123
samos123 / tsinghua_vpn.sh
Last active August 29, 2015 14:26
small bash script to connect and disconnect to tsinghua vpn and manually add routes.
#!/bin/bash
if [ "$1" == "connect" ]
then
sudo pon my_tunnel
until ip a | grep -q 192.168.55.1;
do