Skip to content

Instantly share code, notes, and snippets.

@benhaan
benhaan / list_port_config.py
Created January 6, 2015 05:35
Fetch all the interfaces from a Cisco switch and return its config, specifically VLAN, name, description, and type (access or trunk)
from __future__ import print_function
from snimpy.manager import Manager as M
from snimpy.manager import load
from snimpy.snmp import SNMPNoSuchInstance
#import pymysql
# Load up SNMP MIBs

Keybase proof

I hereby claim:

  • I am benhaan on github.
  • I am benhaan (https://keybase.io/benhaan) on keybase.
  • I have a public key whose fingerprint is 7546 ED97 4856 6D79 DC3B 1BAA 69C2 61CF D94D 8695

To claim this, I am signing this object:

@benhaan
benhaan / nginx.conf
Created October 24, 2012 21:13
inteligent routing in nginx
#user nobody;
worker_processes 1;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
var sio = require('socket.io');
var io = sio.listen(8080);
global.channels = [];
var lobby = io.of('/lobby')
.on('connection', function (lobby_socket) {
lobby_socket.on('join channel', function (channel_name, channel_cb) {
global.channels[channel_name] = io.of('/' + channel_name).authorization(function (handshakeData, auth_cb) {
#!/bin/bash
# init script for mongodb
# chkconfig: 2345 70 11
# description: mongod
# processname: mongod
# pidfile: /var/run/mongodb.pid
# Source function library.
. /etc/rc.d/init.d/functions
# Changes to the default path where the databases are stored. By default they are stored in /data/db
dbpath = /var/lib/mongodb
# Sets the path where the log will be kept
logpath = /var/log/mongod.log
#!/bin/sh
#
# init.d script with LSB support.
#
# Copyright (c) 2007 Javier Fernandez-Sanguino <jfs@debian.org>
#
# This is free software; you may redistribute it and/or modify
# it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2,
# or (at your option) any later version.
#! /bin/sh
### BEGIN INIT INFO
# Provides: php-fpm
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts php-fpm
# Description: starts the PHP FastCGI Process Manager daemon
./configure \
--with-libdir=lib64 \
--enable-fpm \
--enable-debug \
--disable-ipv6 \
--enable-bcmath \
--enable-calendar \
--enable-ftp \
--enable-gd-native-ttf \
--enable-mbstring \
../configure --with-libdir=lib64 --with-fpm --with-fpm-conf=/etc/php53/php-fpm.conf --with-libevent=/usr/local --with-config-file-path=/etc/php53 --with-config-file-scan-dir=/etc/php53/conf.d --disable-ipv6 --enable-sockets --enable-sqlite-utf8 --enable-zip --enable-sysvmsg --enable-sysvsem --enable-sysvshm --with-zlib --with-gd --with-curl --with-jpeg-dir=/usr --with-png-dir=/usr --with-freetype-dir=/usr --enable-gd-native-ttf --with-ttf --with-mhash --with-mcrypt --disable-safe-mode --enable-mbstring --enable-ftp --enable-calendar --enable-bcmath --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-readline --disable-debug --with-openssl --with-xmlrpc --with-libxml-dir=/usr/local --with-pear=/usr/local/lib64/php53 --enable-soap --disable-rpath