Skip to content

Instantly share code, notes, and snippets.

View levidehaan's full-sized avatar
💭
I haz t3h codes

Levi DeHaan levidehaan

💭
I haz t3h codes
View GitHub Profile

Keybase proof

I hereby claim:

  • I am levidehaan on github.
  • I am levidehaan (https://keybase.io/levidehaan) on keybase.
  • I have a public key ASD87p4EdZqHHilz1C6UD4bzrTZXllDR_rxHMQi3w0u7DQo

To claim this, I am signing this object:

@levidehaan
levidehaan / Directions
Created May 6, 2013 17:56
SSH Multi-Hop Tunneling
Command to run:
ssh -L 2222:localhost:8501 user@remoteserver.com
where 2222 is the local port mapping it can be any number above 1000
where localhost must be set to localhost and refers to your current connection
where 8501 is the port you will be opening up on the remote machine
where user@remoteserver.com is the first hop in your quest for internal access
@levidehaan
levidehaan / main.js
Created April 12, 2012 00:33
Little Compressor
var http = require("http"),
url = require("url"),
path = require("path"),
fs = require("fs"),
uggoP = require("uglify-js").parser,
uggo = require("uglify-js").uglify,
port = process.argv[2] || 8675,
server = http.createServer(function(request, response) {
var uri = url.parse(request.url).pathname, combined_file = "";
if(uri.indexOf(",") >= 1){
var render = function(template, context) {
var chez, divm = template.replace(/-.*$/, "");
if( typeof context === "function") {
switch(true) {
case (context.toString().indexOf("playlists") > 0):
$.when(context()).then(function(data) {
$(divm).link(data, template).listview();
$(template).template();
@levidehaan
levidehaan / .zshrc
Created February 27, 2012 18:07
my oh-my-zsh config
ZSH=$HOME/.oh-my-zsh
ZSH_THEME="xiong-chiamiov-plus"
plugins=(git command-not-found debian git-flow history-substring-search kate node npm python ssh-agent vi-mode)
source $ZSH/oh-my-zsh.sh
export PATH=/home/th3m4d0n3/.nvm/v0.6.11/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/opt/builds
#an example of using zlib to decompress a return from stackoverflow's api
#written in coffeescript and nodejs
zlib = require 'zlib'
http = require 'http'
module.exports = (robot) ->
robot.respond /(stack|ss) ?(find:.*) ?(tags:.*)/i, (msg)->
using child_processes, if i create a new process,
ssh = spawn('ssh', ['root@remotehost.com']);
and then put a listener on stdout
ssh.stdout.on('data', function(data){
console.log(data);
});
and then send some stuff
ssh.stdin.write("ls -alh\n");
and
ssh.stdin.write("touch testing.txt\n");