Skip to content

Instantly share code, notes, and snippets.

Eddie Antonio Santos eddieantonio

Block or report user

Report or block eddieantonio

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
eddieantonio /
Last active Aug 29, 2015
Character-wise w-shingling, or at least as I understand it.
#!/usr/bin/env python
from itertools import islice, izip, chain
# Returns a set of shingles for the given entity.
def shingles(entity, w=3):
Performs charachter-wise shingling on an entity. Natural language
processing! Returns the (frozen) set of all shingles for a given entity.
eddieantonio /
Created Mar 23, 2014
Creates some entities/relations that can be imported using mongoimport.
#!/usr/bin/env python
import yaml
import json
from bson.objectid import ObjectId
from itertools import count
def parse_database(database):
eddieantonio / pi.c
Created Aug 8, 2014
Double the shenanigans
View pi.c
#include <stdio.h>
#ifndef M_PI
#define M_PI 3.14159265358979323846264338327950288
typedef union {
# Code transliterated from
unless String::trim
do ->
rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g
String::trim = -> @replace(rtrim, '')
import os.path
def parent(n=1):
Hacky way to get the nth parent of THIS file.
Suppose this file was put in `/tmp/` which is symlinked to `/private/tmp`:
>>> parent(n=1)
#!/usr/bin/env python
cevag(ynzoqn ___:(ynzoqn __:
___ (ynzoqn *_:__(__ ) ( *_)
)) ( ynzoqn _ : ___( ynzoqn *
__ : _ (_ ) (*__)))) ( ynzoqn
___:(ynzoqn __,____, _ : ____
vs abg yra( _ ) ryfr ___ (__,
__(____,_ [ Snyfr]), _[Gehr:]
eddieantonio / stupid.rb
Last active Aug 29, 2015
I don't know why.
View stupid.rb
#!/usr/bin/env ruby
# The Xcode prefix for C stuff.
PREFIX = `xcrun --show-sdk-path`.chomp
# Ze masterpiece.
def have_a_nap
puts "Le 💤 "
eddieantonio / attr_boolean.rb
Last active Aug 29, 2015
My attempt at this metaprogramming balleyhoo. Did I really need to use eval?
View attr_boolean.rb
#!/usr/bin/env ruby
require 'ripper'
class Module
# Public: Defines a behooked getter for the given attribute names.
# symbols - names of the @attribute to access.
def attr_boolean(*symbols)
eddieantonio / to_utf8.rb
Last active Aug 29, 2015
Numeric#to_utf8 -> turns a number into the UTF-8 string of its codepoint.
View to_utf8.rb
# Defines a method
module CoreExtensions
module CodepointToUTF8
# Returns string of the number interpreted as a Unicode code point.
def to_utf8
# Installs the Monkey-Patch on Numeric.
You can’t perform that action at this time.