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
@Spaceghost
Spaceghost / netboot.sh
Created August 4, 2021 08:48
One-shot to netboot.xyz
wget -c "https://boot.netboot.xyz/ipxe/netboot.xyz.lkrn" -O /boot/netboot.xyz.lkrn && \
cat > /etc/grub.d/40_custom <<EOF
#!/bin/sh
exec tail -n +3 \$0
menuentry 'netboot.xyz' {
set root='hd0,msdos1'
linux16 /netboot.xyz.lkrn
}
EOF
update-grub
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 / Math
Created April 29, 2011 03:45
Solve for i: 9x-7i > 3(3x-7u)
Solve for i: 9x-7i > 3(3x-7u)
9x-7i > 3(3x-7u)
-9x-7i > 9x-21u
-7i > -21u
-i > -3u
i < 3u
@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
01:15:52 <pipecloud> While working on getting rubygems.org to work on ruby 2.1 and 2.0, I've seem to hit a problem. the gem archives in test/gems/dos* are being used in test/unit/pusher_test.rb and they return StringIO objects. I've called #read on them prior to passing them Cutter.new, but I'm out of my understanding when they complain about "string contains null byte". I'm
01:15:52 <pipecloud> curious about what I should change, but more curious about how they pass currently.
01:16:58 <pipecloud> I'm going to be checking into 1.9.3 and seeing how it works there and hopefully that'll give me some more information.
01:24:00 <pipecloud> Where's sj26 when you need him? :(
01:34:07 <pipecloud> I doubt it has anything to do with marshalling like in https://groups.google.com/forum/#!msg/ruby-core-google/eMLd2MgOnVU/OedFMqUOcuEJ which drbrain_ commented on, but I guess I'll keep digging.
@Spaceghost
Spaceghost / inline
Created December 31, 2013 07:09
wrapped is unnecessary
def hooman(name)
"I am a pink, fleshy human named, #{name}."
rescue ArgumentError => e
self.logger "Someone screwed up again, bob."
raise HumanError(e)
end
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