Skip to content

Instantly share code, notes, and snippets.

View Daenyth's full-sized avatar

Alanna Stone Daenyth

View GitHub Profile
problem4 :: Int
problem4 = max $ filter isPalindrome $ nub numbers
where numbers = let numList = [100 .. 999] in [ x*y | x <- numList, y <- numList ]
master!euler/haskell *> ghci 4/euler4.hs
GHCi, version 6.12.1: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package ffi-1.0 ... linking ... done.
[1 of 1] Compiling Main ( 4/euler4.hs, interpreted )
Ok, modules loaded: Main.
*Main> main
Loading package array-0.3.0.0 ... linking ... done.
@Daenyth
Daenyth / gist:556467
Created August 29, 2010 17:11
Print out reddit saved links with tinyurls
import reddit # http://github.com/mellort/reddit_api
import tinyurl # http://pypi.python.org/pypi/TinyUrl/0.1.0
r = reddit.Reddit()
r.login(username='...', password='...')
items = [(l.title, tinyurl.create_one(l.url)) for l in r.get_saved_links()]
for item in items: print "%s -- %s\n" % item
In [62]: mutagen.File?
Type: function
Base Class: <type 'function'>
String Form: <function File at 0x1141140>
Namespace: Interactive
File: /usr/lib/python2.6/site-packages/mutagen/__init__.py
Definition: mutagen.File(filename, options=None, easy=False)
Docstring:
Guess the type of the file and try to open it.
for k, v in itertools.izip(self.__hdr_fields__,
struct.unpack(self.__hdr_fmt__, buf[:self.__hdr_len__])):
setattr(self, k, v)
#!/bin/bash
shingle_size=4
feature_count=1024
if [[ ! -d $1 || ! -d $2 ]]; then
echo "Usage: <dir1> <dir2>"
exit 1
fi
simhash -f $feature_count -s $shingle_size -w $1/*.class
simhash -f $feature_count -s $shingle_size -w $2/*.class
@Daenyth
Daenyth / Errors
Created December 16, 2010 03:08
error output
$ wget http://codepad.org/y4D2CSk3 -O cardlist.txt
$ ./cards2spoiler.py > test
C: Abyssal Gatekeeper
C: Acidic Slime
C: Act of Treason
C: Adarkar Valkyrie
C: Adarkar Wastes
C: Adventuring Gear
C: Aether Spellbomb
Traceback (most recent call last):
1 Mox Emerald
1 Mox Jet
1 Mox Pearl
1 Mox Ruby
1 Mox Sapphire
1 Black Lotus
1 Sol Ring
1 Mana Crypt
1 Island
#!/usr/bin/python
"""
Implements a Tree data structure for annotated MAC Addresses. This is useful for lookups where more precision than just the MAC vendor is useful (eg, a specific model, NIC series, etc).
Works with python 2 and 3
"""
from __future__ import print_function
@Daenyth
Daenyth / gist:988677
Created May 24, 2011 13:19
Blue storm.
SB: 2 Trygon Predator
SB: 1 Forest
SB: 1 Helm of Obedience
SB: 1 Rebuild
SB: 2 Hurkyl's Recall
SB: 2 Island
SB: 2 Pithing Needle
SB: 4 Leyline of the Void
1 Ancestral Recall
1 Black Lotus