Skip to content

Instantly share code, notes, and snippets.

View Spaceghost's full-sized avatar
👻
Building distributed and decentralized systems that run in the browser

Johnneylee Jack Rollins Spaceghost

👻
Building distributed and decentralized systems that run in the browser
View GitHub Profile
@Spaceghost
Spaceghost / DecryptWindowsProductKey.py
Created March 19, 2011 01:06
A script to decrypt windows product keys written in python
import _winreg
def DecodeKey(rpk):
rpkOffset = 52
i = 28
szPossibleChars = "BCDFGHJKMPQRTVWXY2346789"
szProductKey = ""
while i >= 0:
dwAccumulator = 0
@Spaceghost
Spaceghost / octocat_zen.sh
Created November 14, 2012 03:28 — forked from pengwynn/octocat_zen.sh
GitHub Zen
$ curl https://api.github.com/zen | octocatsay
MMM. .MMM
MMMMMMMMMMMMMMMMMMM
MMMMMMMMMMMMMMMMMMM ____________________________
MMMMMMMMMMMMMMMMMMMMM | |
MMMMMMMMMMMMMMMMMMMMMMM | Practicality beats purity. |
MMMMMMMMMMMMMMMMMMMMMMMM |_ ________________________|
MMMM::- -:::::::- -::MMMM |/
MM~:~ ~:::::~ ~:~MM
begin
require "bundler/inline"
rescue LoadError => e
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler"
raise e
end
gemfile(true) do
source "https://rubygems.org"
@Spaceghost
Spaceghost / mirror_test.sh
Created January 14, 2021 07:54 — forked from lox/mirror_test.sh
A bash script to select the fastest ubuntu apt geo-mirror
#!/bin/bash -e
# mirror_test.sh
# benchmarks closest ubuntu mirrors and outputs them in speed order
# bash -c "$(curl -fsSL https://gist.githubusercontent.com/lox/9152137/raw/mirror_test.sh)"
RELEASE=$(lsb_release -c -s 2>/dev/null || echo 14.04)
MIRRORS=$(curl -s http://mirrors.ubuntu.com/mirrors.txt)
TESTFILE="dists/$RELEASE/main/binary-amd64/Packages.bz2"
TIMEOUT=1
@Spaceghost
Spaceghost / smux.sh
Created October 3, 2020 04:01
autossh combined with tmux for a mosh like behaior
function smux {
AUTOSSH_POLL=10
AUTOSSH_PORT=$(awk 'BEGIN { srand(); do r = rand()*32000; while ( r < 20000 ); printf("%d\n",r) }' < /dev/null)
#AUTOSSH_GATETIME=30
#AUTOSSH_LOGFILE=autossh.$HOST.log
#AUTOSSH_DEBUG=yes
#AUTOSSH_PATH=/usr/local/bin/ssh
export AUTOSSH_POLL AUTOSSH_LOGFILE AUTOSSH_DEBUG AUTOSSH_PATH AUTOSSH_GATETIME AUTOSSH_PORT
def search(tp_id1, rule_id1, tp_id2, rule_id2)
ActiveRecord::Base.connection.execute("SELECT * FROM tracked_points, rules WHERE (tracked_points.id = ? AND rules.id = ?) OR (tracked_points.id = ? AND rules.id = ?)", tp_id1, rule_id1, tp_id2, rule_id2)
end
# Module
# ------
module ProtectedFields
# There is probably a nicer way to do this...
def self.included(base)
base.class_eval {
def self.protected_attributes(attrs = [])
@@protected_attributes = attrs
end
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>net.damacy.releasemem</string>
<key>ProgramArguments</key>
<array>
<string>/Users/jrollins/usr/bin/releasemem.py</string>
</array>
#!/usr/bin/env bash
apt-get -y update
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline5-dev libyaml-dev
cd /tmp
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p125.tar.gz
tar -xvzf ruby-1.9.3-p125.tar.gz
cd ruby-1.9.3-p125/
./configure --prefix=/usr/local
make
make install
@Spaceghost
Spaceghost / SomeController
Created November 6, 2012 18:56 — forked from pankajmore/gist:4026700
local variable in js.erb
respond_to do |format|
format.js
end
def show
@course = OfferedCourse.find(params[:id])
end