Skip to content

Instantly share code, notes, and snippets.

View allen-munsch's full-sized avatar
⁉️

James allen-munsch

⁉️
View GitHub Profile
@proppy
proppy / depy.sh
Created August 10, 2011 12:49
depy: hack to vendor a python library and its dependencies
set -e
[ $# -ge 2 ] || (echo 'usage: depy PACKAGES... DIRECTORY' ; false)
PACKAGES=${@:1:$(($#-1))}
DESTINATION=${!#}
TMPDIR=/tmp/depy.$$
pip install -E $TMPDIR $PACKAGES
find $TMPDIR -type f -name "*.pyc" -delete
PACKAGES=$(pip freeze -E $TMPDIR | cut -d '=' -f 1 | xargs -n 1 -I @package@ find $TMPDIR -ipath '*/@package@/__init__.py' | sed -e s/__init__\.py//)
mkdir -p $DESTINATION
cp -R $PACKAGES $DESTINATION
@mdbecker
mdbecker / gist:1309633
Created October 24, 2011 17:50
multiprocess && gevent example
from multiprocessing import Pool as MPool
from time import sleep
import datetime
import multiprocessing
import random
def time_request():
from gevent import monkey; monkey.patch_socket
from jsonrequester import JsonRequester
@indygreg
indygreg / find_old_lines.pl
Created June 17, 2012 20:17
Find oldest lines in git repository
#!/usr/bin/perl
# This script parses Git blame's "porcelain" output format and
# ascertains the oldest lines of code seen.
#
# If you want to perform a custom report, just define your own callback
# function and invoke parse_porcelain() with it.
#
# The expected input format is slightly modified from raw `git blame
# -p`. Here is an example script for producing input:
@indiejoseph
indiejoseph / gist:3047593
Created July 4, 2012 14:13
UserScript - XHR Interceptor
function Interceptor(nativeOpenWrapper, nativeSendWrapper) {
XMLHttpRequest.prototype.open = function () {
// Code here to intercept XHR
return nativeOpenWrapper.apply(this, arguments);
}
XMLHttpRequest.prototype.send = function () {
this.onloadend = function() {
if(this.capture) {
console.log(this.responseText);
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active May 22, 2024 04:20
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@nikcub
nikcub / README.md
Created October 4, 2012 13:06
Facebook PHP Source Code from August 2007
@dmytro
dmytro / ssh-multi.sh
Created October 31, 2012 03:46
Start multiple synchronized SSH connections with Tmux
#!/bin/bash
# ssh-multi
# D.Kovalov
# Based on http://linuxpixies.blogspot.jp/2011/06/tmux-copy-mode-and-how-to-control.html
# a script to ssh multiple servers over multiple tmux panes
starttmux() {
if [ -z "$HOSTS" ]; then
@craSH
craSH / iptables-sol.sh
Last active September 4, 2018 18:23
Masquerade/redirect incoming TCP connections on all ports (1:65535) to $dst_ip port $dst_port.Great for creating a proxy/jump box that lets you SSH to your server, in cases when you're on strange/(poorly) restrictive networks and need to tunnel out.
#!/bin/bash
#
# Masquerade/redirect incoming TCP connections on all ports (1:65535) to $dst_ip port $dst_port
# Call with -f to force update, even if IP cache exists and shows no changes.
# Make sure this isn't a CNAME! Otherwise the below dig command won't follow it and return an IP.
dst_host="neg9.org"
target_ns="google-public-dns-a.google.com"
dst_port=22
@gustavohenrique
gustavohenrique / soap-curl-shell
Created June 11, 2013 19:24
SOAP request using curl
# request.xml
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wst="http://sensedia.com/repository/wstoolkit">
<soapenv:Header>
<wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:UsernameToken wsu:Id="UsernameToken-1">
<wsse:Username>system</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">manager</wsse:Password>
<wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">DWk64SMfJ6RxHAKgPRGtPA==</wsse:Nonce>
<wsu:Created>2013-04-17T18:36:54.013Z</wsu:Created>
</wsse:UsernameToken>
@soarez
soarez / ca.md
Last active May 3, 2024 00:04
How to setup your own CA with OpenSSL

How to setup your own CA with OpenSSL

For educational reasons I've decided to create my own CA. Here is what I learned.

First things first

Lets get some context first.