Skip to content

Instantly share code, notes, and snippets.

View drusepth's full-sized avatar
💭
hacking away on notebook.ai

Andrew Brown drusepth

💭
hacking away on notebook.ai
View GitHub Profile
@drusepth
drusepth / hellolleh.rb
Created February 26, 2015 03:00
palindromic hello world
def method_missing x; "Hello World"; end; puts stup; dne; "dlroW olleH"; x gnissim_dohtem fed
def method_missing x
"Hello World"
end
puts stup
dne
"dlroW olleH"
x gnissim_dohtem fed
@drusepth
drusepth / a2a.js
Created March 1, 2015 01:36
automatically a2a everyone with a free a2a price
$('div.answer_count_row.light_gray').filter(function (index, row) {
return $(row).text().split("•")[1].trim() == "Free to Ask";
}).map(function (index, row) {
return $(row).closest('div.WantedAnswerSuggestionRow').find('a.ask_to_answer')[0];
}).click();
@drusepth
drusepth / names.rb
Last active August 29, 2015 14:17
rhyming-renamer
nicks = %w{
lm aji brodes cbgbt dru ek horm ianweller jruby khwain
montgc narada rd reed suroi suscd woodrufb
}
d = File.readlines('dictionary.txt').to_a
puts nicks.map {|nick|
o = nick.downcase!.dup
while (results = d.select{|line| line.chomp.end_with?(nick)}).length == 0 && nick.length > 0
nick = nick[1, nick.length]
end
expected = %w{1 2 Fizz 4 Buzz Fizz 7 8 Fizz Buzz 11 Fizz 13 14 FizzBuzz};
seed = 0;
begin
puts "trying seed #{seed}"
r = Random.new(seed)
throw :nope unless (0..11).to_a.all? {|i| [i+1, "Fizz", "Buzz", "FizzBuzz"][r.rand(4)] == expected[i] }
puts "drusepth: Seed #{seed} will do the job just fine"
rescue
seed += 1
require 'google-search'
require 'thread'
require 'nokogiri'
require 'open-uri'
CASCADE_SNIPPETS = false
def method_missing method_name, *args, &block
result_queue = Queue.new
#!/usr/bin/ruby
# Dear jruby,
#
# May you never have woes about rounding numbers again.
#
# Sincerely,
# Me
# Constants
@drusepth
drusepth / msn.pl
Created June 27, 2015 20:32
msn poc
#!/usr/bin/perl
use strict;
use warnings;
use IO::Socket;
use LWP::UserAgent;
my ($msn_username, $msn_password) = ('xjessicaxfieryx@hotmail.com', '');
my ($msn_server, $msn_port) = ('messenger.hotmail.com', 1863);
#!/usr/bin/perl
use strict;
use warnings;
use googlescraper;
open TOPICS, "topics.txt";
my @topics = <TOPICS>;
close TOPICS;
my @urls;
#!/usr/bin/perl
use strict;
use warnings;
use IO::Socket;
use LWP::UserAgent;
use LWP::Simple;
my (%_PROGRAM, %_SETTINGS, %_SYSTEM, %_DUMMY);
#
# Usage: ruby score_subreddit.rb <list of subreddits>
#
# Computes the Flesch-Kincaid grade level of the last 25 comments of the given subreddits.
#
# For example:
# > ruby score_subreddit.rb science worldnews funny
# science: 8.33
# worldnews: 9.71
# funny: 5.32