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 /
Created Jul 22, 2013
A useless Python script I used to collect JARs and WARs from a directory of Maven projects.
#!/usr/bin/env python
Build all Maven files and dump all of the jars into a directory.
import os
import sys
import re
eddieantonio /
Created Jul 29, 2013
From a comment near the bottom of the file: "I wanted to know if 'Awakening' was significantly different from the rest. It isn't. "
#!/usr/bin/env python
# Copyright 2013 Eddie Antonio Santos
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
View graphical.hs
import Data.List (sort)
-- Given a degree sequence, determines whether it is graphical. Returns a list
-- of steps from the base case to the original degree sequence.
graphical :: [Int] -> Maybe [[Int]]
graphical ds | even $ sum ds = graphical' ds []
-- By the handshaking lemma, cannot be a graph with odd sum:
| otherwise = Nothing
graphical' ds previous
eddieantonio /
Created Sep 28, 2013
Fabric: task to authorize your SSH key on a remote host.
Installs your SSH key on other hosts. A fabfile for lazy people.
from fabric.api import task, run, put, env, cd
# Use sh instead of bash. = '/bin/sh -l -c'
eddieantonio /
Last active Jan 26, 2016
marginalize.js: Intended to be a bookmarklet that gives unstyled pages margins and a somewhat more readable font.
# If you have OS X and have UglifyJS installed, this uglifies Marginalize and
# puts the `javascript:` URL into the clipbord. Hoorah!
uglifyjs -c -m -o marginalize.min.js marginalize.js
printf 'javascript:' | cat - marginalize.min.js | pbcopy
#!/usr/bin/env python
from itertools import groupby
def k_sized_groups(sequence, k):
Generates iterable groups with a maximum of size of K members from the
given sequence.
>>> [list(g) for g in k_sized_groups([1, 2, 3, 4], 2)]
eddieantonio / line_joiner.hs
Created Nov 25, 2013
Silly scripting language golf. Must read in a line of input, take out all of the spaces, and print it _immediately_ (so it can be sort of interactive).
View line_joiner.hs
#!/usr/bin/env runhaskell
import Data.List (intercalate)
joinLines input = unlines $ map joinLine (lines input)
joinLine line = intercalate "" (words line)
main = interact joinLines
# Maybe in Coffeescript
# Terminology from Haskell; API from Scala
# Inspired by
just = (value) ->
# Applying the monad will act as "map" by default
# To make people even lazier, 'this' is bound to the value anyway.
monad = (f) -> just, value)
monad.getOrElse = -> value
monad.getOr = -> value
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):
You can’t perform that action at this time.