This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import praw | |
r = praw.Reddit('Homophone Triplet Game by /u/NotFlameRetardant') | |
r.login('HomophoneTripletBot', PASSWORD, disable_warning=True) | |
submission = r.get_submission(submission_id='3j1lso') | |
flat_comments = praw.helpers.flatten_tree(submission.comments) | |
already_done = set() | |
count = 0 | |
wordset = [['there', 'their', 'they\'re'], ['two', 'too', 'to'], ['buy', 'by', 'bye'], ['write', 'right', 'rite']] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import praw | |
r = praw.Reddit('Homophone Triplet Game by /u/NotFlameRetardant') | |
r.login('HomophoneTripletBot', PASSWORD, disable_warning=True) | |
submission = r.get_submission(submission_id='3j1lso') | |
flat_comments = praw.helpers.flatten_tree(submission.comments) | |
already_done = set() | |
count = 0 | |
wordset = [['there', 'their', 'they\'re'], ['two', 'too', 'to'], ['buy', 'by', 'bye'], ['write', 'right', 'rite']] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object Matasano { | |
def hexToBytes(hex: String): Array[Byte] = { | |
hex.replaceAll("[^0-9A-Fa-f]", "").sliding(2,2).toArray.map(Integer.parseInt(_, 16).toByte) | |
} | |
def bytesToHex(bytes: Array[Byte]): String = { | |
bytes.map("%02x" format _).mkString | |
} | |
def encode64(b: Array[Byte]): String = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@$container.on 'submit', (e) => | |
e.preventDefault() | |
formData = new FormData(@$container.get(0)) | |
formData.append("user[settings_file]", @file) | |
$.ajax({ | |
url: @$container.attr('action'), | |
type: @$container.attr('method'), | |
contentType: false, | |
processData: false, | |
data: formData, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* If your shitbox doesn't have getopt, step into the nineties already. */ | |
/* optarg, optind = next-argv-component [i.e. flag arg]; optopt = last-char */ | |
while ((x = getopt (argc, argv, "ae:g:G:hi:lno:p:rs:tuvw:z")) != EOF) { | |
/* Debug (("in go: x now %c, optarg %x optind %d", x, optarg, optind)) */ | |
switch (x) { | |
case 'a': | |
bail ("all-A-records NIY"); | |
o_alla++; break; | |
#ifdef GAPING_SECURITY_HOLE | |
case 'e': /* prog to exec */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// An attempt at implementing the polygon labeling algo at: | |
// http://mapcontext.com/autocarto/proceedings/auto-carto-8/pdf/an-algorithm-for-locating-candidate-labeling-boxes-within-a-polygon.pdf | |
// I'm so sorry if you ever have to try and fix this code. Godspeed | |
function findOptimalLabelLocation(section_point_array, name) { | |
var xy_objs = _.map(section_point_array, function(xy) { return {x: xy[0], y: xy[1]} }); | |
var simplified = simplify(xy_objs, 1); | |
var edges = []; | |
for (var i = 0; i < simplified.length-1; i++) { | |
var current_point = simplified[i]; | |
var next_point = (i == simplified.length-1) ? simplified[0] : simplified[i+1]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'koala' | |
graph = Koala::Facebook::API.new("APIKEY") | |
one_year_ago = Time.now - (52*7*24*60*60) | |
feed = graph.get_object("355625917946909/feed?fields=from,likes.limit(10000000),link,comments.limit(10000000)&limit=10000000&since=#{one_year_ago.to_i}") | |
most_liked = feed.select{|post| !post["likes"].nil? }.sort {|a,b| b["likes"]["data"].size <=> a["likes"]["data"].size} | |
most_liked[0..15].each do |post| | |
puts '%-40s' % "#{post["from"]["name"]}:" + "www.facebook.com/groups/#{post["id"].gsub(/_/,"/")} " + "Likes: #{post["likes"]["data"].length}" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$( function() { | |
var width, height, canvas, ctx, points, target, animateHeader = true; | |
// Main | |
initHeader(); | |
initAnimation(); | |
addListeners(); | |
function initHeader() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Vector = function(x, y) { | |
this.x = x; | |
this.y = y; | |
this.addInPlace = function(vector) { | |
this.x += vector.x; | |
this.y += vector.y; | |
return this; | |
} |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.