Skip to content

Instantly share code, notes, and snippets.

@oconnor663
oconnor663 / fizzbuzz.py
Created October 5, 2012 00:09
fizzbuzz.py
#!/usr/bin/python3
pairs = (
(3, "Fizz"),
(5, "Buzz"),
)
@oconnor663
oconnor663 / FizzBuzz.hs
Created October 5, 2012 00:56
FizzBuzz.hs
pairs = [(3, "Fizz"), (5, "Buzz")]
main = mapM_ (putStrLn . fizzLine) [0..100]
where fizzLine x = if output /= "" then output else show x
where output = concat (map snd matches)
matches = filter (\pair -> x `rem` fst pair == 0) pairs
import System.Environment
import Control.Monad
addNumbers strs = zipWith (\a b -> show a ++ " " ++ b) [1..] strs
main = do
args <- getArgs
text <- if length args > 0
then readFile (head args)
else getContents
diff --git a/PKGBUILD.buggy b/PKGBUILD
index c4ad354..b8c01ab 100644
--- a/PKGBUILD.buggy
+++ b/PKGBUILD
@@ -31,9 +31,6 @@ prepare() {
# Get the ANT_HOME environment variable
source /etc/profile.d/apache-ant.sh
- mkdir -p $pkgdir/usr/share/eclipse
- mkdir -p $pkgdir/usr/share/vim/vimfiles
@oconnor663
oconnor663 / fbmessenger.fb
Last active December 22, 2015 09:58
testing
require 'formula'
class Fbmessenger < Formula
homepage 'https://github.com/oconnor663/fbmessenger'
url 'https://github.com/oconnor663/fbmessenger/archive/master.zip'
version '0.2.0'
# The build won't work without the brew version of python2
depends_on "python"
@oconnor663
oconnor663 / udpclient.py
Created September 7, 2013 03:07
UDP test client
import sys
import socket
import json
import hashlib
UDP_IP = "127.0.0.1"
UDP_PORT = 5005
sock = socket.socket(socket.AF_INET, # Internet
socket.SOCK_DGRAM) # UDP
@oconnor663
oconnor663 / udpserver.py
Created September 7, 2013 03:08
UDP test server
import socket
import hashlib
import json
UDP_IP = "127.0.0.1"
UDP_PORT = 5005
sock = socket.socket(socket.AF_INET, # Internet
socket.SOCK_DGRAM) # UDP
sock.bind((UDP_IP, UDP_PORT))
@oconnor663
oconnor663 / imagemagick-for-rmagick.patch
Created September 9, 2013 20:47
imagemagick PKGBUILD changes for compatibility with rmagick
diff --git a/PKGBUILD.old b/PKGBUILD
index 3fd9a4a..ab2a25d 100644
--- a/PKGBUILD.old
+++ b/PKGBUILD
@@ -27,7 +27,7 @@ prepare() {
build() {
cd ImageMagick-${pkgver%.*}-${pkgver##*.}
./configure --prefix=/usr --sysconfdir=/etc --with-modules --disable-static \
- --enable-hdri --with-wmf --with-openexr --with-xml --with-lcms2 --with-jp2 \
+ --with-wmf --with-openexr --with-xml --with-lcms2 --with-jp2 \
@oconnor663
oconnor663 / gist:7934599
Created December 12, 2013 20:11
fbmessenger crash
*** Error in `/usr/bin/python3': malloc(): smallbin double linked list corrupted: 0x00000000041de6a0 ***
======= Backtrace: =========
/usr/lib/libc.so.6(+0x72e5f)[0x7f3cf3c3ee5f]
/usr/lib/libc.so.6(+0x7862e)[0x7f3cf3c4462e]
/usr/lib/libc.so.6(+0x7a834)[0x7f3cf3c46834]
/usr/lib/libc.so.6(__libc_malloc+0x60)[0x7f3cf3c47c50]
/usr/lib/libcurl.so(+0xc16d)[0x7f3c444cf16d]
/usr/lib/libcurl.so(+0xc383)[0x7f3c444cf383]
/usr/lib/libcurl.so(+0xd53e)[0x7f3c444d053e]
/usr/lib/libcurl.so(+0x11d69)[0x7f3c444d4d69]
@oconnor663
oconnor663 / gist:8063575
Created December 21, 2013 00:01
How to restore Kingdom Rush game data from backup.ab
# This might, maybe, conceivably work as a script. But I suggest executing all
# the commands manually, because I doubt everything will Just Work,
# particularly the 'adb root' command. Setting the '-e' option makes the script
# exit on the first error, in case you do want to run it.
set -e
# First, make a copy of backup.ab, because if we accidentally delete it we're
# screwed.
OUR_TMPDIR=`mktemp -d`
cp backup.ab $OUR_TMPDIR