Skip to content

Instantly share code, notes, and snippets.

View jwilkins's full-sized avatar

Jonathan Wilkins jwilkins

  • San Francisco, CA
View GitHub Profile
@jwilkins
jwilkins / shhh.rb
Created April 17, 2013 19:42
scan for ssh supported auth methods (track down any hosts that still support passwords instead of keys)
require 'net/ssh'
require 'debugger'
require 'net/ssh/transport/session'
require 'net/ssh/authentication/methods/password'
require 'net/ssh/authentication/session'
options = {
:user => 'root',
:config => nil,
:password => 'incorrect_password',
@jwilkins
jwilkins / torrentcheck.rb
Last active December 16, 2015 02:09
torrentcheck formula for homebrew
require 'formula'
class Torrentcheck < Formula
url 'http://sourceforge.net/projects/torrentcheck/files/torrentcheck-1.00.zip'
homepage 'http://torrentcheck.sourceforge.net/'
sha256 'a839f9ac9669d942f83af33db96ce9902d84f85592c99b568ef0f5232ff318c5'
def install
inreplace "torrentcheck.c", "#include <malloc.h>", ""
system "#{ENV.cc} #{ENV.cflags} torrentcheck.c sha1.c -o torrentcheck"
@jwilkins
jwilkins / httparallel.rb
Last active December 28, 2024 15:11
parallel http/https download with typhoeus
#!/usr/bin/env ruby
# 25s curl -o all.gz.curl http://download.openwall.net/pub/passwords/wordlists/all.gz
# 11s for this script with 4 parallel requests
require 'typhoeus'
def pfetch(url, splits=4)
response = Typhoeus.head(url)
parallelize = false
basename = File.basename(url)
size = nil
@jwilkins
jwilkins / gist:5193892
Created March 19, 2013 05:26
CLI thesaurus
#!/bin/sh
#--------
# Command line thesaurus
BROWSER="/usr/bin/env lynx -source"
HTML2TEXT="/usr/bin/env html2text -style compact"
WEBSITE="http://thesaurus.reference.com/search?q=$1"
if test $1; then
${BROWSER} ${WEBSITE} | ${HTML2TEXT} | ${PAGER}
@jwilkins
jwilkins / p4merge
Created February 27, 2013 21:05 — forked from henrik242/p4merge
#!/bin/bash
for arg; do [[ $arg = /* ]] || arg=$PWD/$arg; absargs+=("$arg"); done;
/Applications/p4merge.app/Contents/Resources/launchp4merge "${absargs[@]}"
@jwilkins
jwilkins / macvim-split-browser.rb
Created February 9, 2013 03:38
Homebrew formula for latest macvim (2012/02/08) merged with alloy's split browser patch
require 'formula'
class MacvimSplitBrowser < Formula
homepage 'https://github.com/jwilkins/macvim/'
url 'https://github.com/jwilkins/macvim/tarball/7b9e621f41ad0193336c18fe0ad239ab2c4cc15a'
version '20130208'
sha1 '8d966f95a335d34e79cf8d7d2f784718b7f1af41'
head 'https://github.com/jwilkins/macvim.git' #, :branch => 'split-browser'
@jwilkins
jwilkins / gist:4705147
Created February 4, 2013 05:19
Faster mysql dump import (innodb) & database size checks
(echo "SET autocommit=0; SET unique_checks=0; SET foreign_key_checks=0;"; cat database_name.sql ; echo "COMMIT;" ) | mysql database_name
# in /etc/my.cnf set:
# innodb_flush_log_at_trx_commit = 2
# innodb_file_per_table
# check size of databases:
#SELECT table_schema AS "Data Base Name",
#ROUND(SUM( data_length + index_length ) / 1024 / 1024, 2) AS "Data Base Size in MB"
#FROM information_schema.TABLES GROUP BY table_schema ;
@jwilkins
jwilkins / gist:3984126
Created October 31, 2012 00:48
ack for hostnames & ip addresses in a source tree (given a domain name)
# hostnames
ack -oa '((\w+\.){1,3}domainname(\.\w+){1,3})' | cut -f3 -d':' | sort| uniq
# ipv4 addresses
ack -oa '((\d+\.){3,3}\d+(:\d+)?)' | cut -f3-4 -d':' | sort| uniq
@jwilkins
jwilkins / gist:3860887
Created October 9, 2012 19:27
HMAC CLI (HMAC-SHA1 HMAC-MD5 HMAC-SHA256 HMAC-SHA512)
#!/usr/bin/env ruby
# echo -n 'asdfasdf' |./hmacsha1 --key foobar'
# 60ff950bea9d6dc7018de881909057e4bba14e26
require 'openssl'
require 'optparse'
key = 'horriblekeychangeme'
algo = 'sha512'
verbose = false
@jwilkins
jwilkins / gist:3744272
Created September 18, 2012 16:55 — forked from mtigas/gist:952344
Mini tutorial for configuring client-side SSL certificates.

Client-side SSL

For excessively paranoid client authentication.

Using self-signed certificate.

Create a Certificate Authority root (which represents this server)

Organization & Common Name: Some human identifier for this server CA.

openssl genrsa -des3 -out ca.key 4096
openssl req -new -x509 -days 365 -key ca.key -out ca.crt