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 / 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 / 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 / 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 / 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',
# coding=UTF-8
from __future__ import division
import re
# This is a naive text summarization algorithm
# Created by Shlomi Babluki
# April, 2013
class SummaryTool(object):
@jwilkins
jwilkins / bootstrap.sh
Created May 12, 2013 01:17
bootstrap a ruby project w/ bundler & rbenv
#!/usr/bin/env bash
NOW=$(date +"%Y%m%d%H%M%S")
echo -n "[*] bootstrapping "
# Export CC to explicitly set the compiler used for cexts.
export CC=cc
function abspath {
if [[ -d "$1" ]]; then
pushd "$1" >/dev/null
pwd
module Kernel
alias :old_req :require
def require(*args)
puts "Require called with: #{args}"
old_req *args
end
end
require 'pp'
#!/usr/bin/env bash
NOW=$(date +"%Y%m%d%H%M%S")
if [ "$#" -eq 0 ];then
echo "Usage $0 keyfile"
echo " or $0 -a Convert all keys"
exit
fi
function convert_file {
@jwilkins
jwilkins / gist:5790778
Created June 16, 2013 04:33
bitmessage setup notes (OSX 10.8)
brew install python qt cryptopp swig sip qt
wget http://download.sf.net/project/pyqt/sip/sip-4.13.3/sip-4.13.3.tar.gz
tar xf sip-4.13.3.tar.gz
cd sip-4.13.3
python configure.py
make && make install
wget http://www.riverbankcomputing.com/static/Downloads/PyQt4/PyQt-x11-gpl-4.10.2-snapshot-11b3001947c9.tar.gz
tar xf PyQt-x11-gpl-4.10.2-snapshot-11b3001947c9.tar.gz
@jwilkins
jwilkins / heroku_entropy.sh
Created July 15, 2013 03:19
monitor entropy on heroku dynos
#!/bin/bash
DATE="date +%Y%m%d%H%M%S"
RDATE="date +%Y%m%d%H%M%S"
IP='curl icanhazip.com'
ENTROPY='cat /proc/sys/kernel/random/entropy_avail'
LOG='heroku-entropy.log'
touch $LOG
while true; do
heroku run "echo \"$($DATE),\$($RDATE),\$($IP),\$DYNO,\$($ENTROPY)\"" 2>&1 | egrep "^20" >> $LOG;
done