Skip to content

Instantly share code, notes, and snippets.

def adjective
['Incredible', 'Unstoppable', 'Unflappable', 'Amazing', 'Scrumtrilescent'].shuffle[0]
end
def pronoun
['Man', 'Woman', 'Boy', 'Girl'].shuffle[0]
end
def animal
@dnase
dnase / gist:5058695
Last active December 14, 2015 08:38
Superhero name generator. GPL'd or whatever. Can't be bothered to paste the license.
#define a method for each part of speech that returns a word at pseudorandom
def adjective
#we get the 0th (first) element of the array after it has been shuffled, resulting in a sort of random selector
['Incredible', 'Unstoppable', 'Unflappable', 'Amazing', 'Scrumtrilescent', 'Purple', 'Bioluminescent'].shuffle[0]
end
def pronoun
['Man', 'Woman', 'Boy', 'Girl'].shuffle[0]
end
@dnase
dnase / gist:5066429
Created March 1, 2013 17:50
Tech 2 typeid.txt
380,Small Shield Extender II
394,Shield Recharger II
400,Small Shield Booster II
406,Micro Shield Transporter II
438,1MN Afterburner II
440,1MN MicroWarpdrive II
448,Warp Scrambler II
482,Miner II
519,Gyrostabilizer II
527,Stasis Webifier II
class Integer
def is_prime?
return false if self <= 1
2.upto(Math.sqrt(self).to_i) { |x| return false if self % x == 0 }
true
end
end
Math.sqrt(600851475143).to_i.downto(2) { |n| puts n if n.is_prime? && 600851475143 % n == 0 }
drone_behavior = (o) ->
{torque, thrust} = o.lib.targeting.simpleTarget o.me, ship.pos if not ship.friendly && ship.queen for ship in o.ships
@dnase
dnase / gist:5535523
Last active December 17, 2015 02:28
ColdFusion 0day
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import requests, time, sys, urllib, hashlib
def flash(color,text,times):
sys.stdout.write(text)
line1 = "\x0d\x1b[2K%s%s" % (color,text)
line2 = "\x0d\x1b[2K%s%s" % (clear,text)
for x in range(0,times):
@dnase
dnase / gist:7429642
Last active December 28, 2015 02:39
#Simple DoS/DDoS script in ruby
#don't use this on servers you don't own.
#don't blame me if you ignore the above and do something illegal.
#todo: add intelligent port rotation on failure
require 'socket'
include Socket::Constants
num_threads = 8
num_connections = 16
@dnase
dnase / gist:7485105
Last active December 28, 2015 10:19
#define a fibonacci enumerator
fibonacci = Enumerator.new do |yielder|
a = b = 1
loop do
yielder << a
a, b = b, a + b
end
end
#curry cache to infinity
@dnase
dnase / gist:10748013
Last active August 29, 2015 13:59
Fun with data parsing!
###########################################################
# How many ig'nant people have named their child some #
# version of "Khaleesi" (which is just an honorific, #
# similar to "queen" - her name is Daenerys Targaryen) #
###########################################################
#SPOILER ALERT: It's over 900.
#Commands:
import sys
if len(sys.argv) == 3:
names = sys.argv[1].split('.')
name_space = '.'.join(names[0:-1])
caller = names[-2]
class_name = names[-1]
method_file = sys.argv[2]
#import from names as strings
test_lib = __import__(name_space)
methods = __import__(method_file)