This file contains hidden or 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
| ; scrape some VCF in to Clojure data | |
| (def raw_data (slurp "/Users/jd/Documents/contacts_dump.vcf")) | |
| (defn deets [args] | |
| { :name (first (filter #(re-matches #"FN.*" %) args)) | |
| :number (first (filter #(re-matches #"TEL.*" %) args))}) | |
| (def contacts | |
| (map deets |
This file contains hidden or 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 'open3' | |
| IP_ADDRESS = '192.168.1.103' | |
| PORT = 1337 | |
| WELCOME_MSG_LENGTH = 'Welcome to chat server'.length + 1 | |
| TEST_MSG = 'hello' | |
| RECVD_MSG = 'Message Sent' | |
| def assert(thing,msg) | |
| unless thing |
This file contains hidden or 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 net = require('net'); | |
| var async = require('async'); | |
| function produceClient (callback) { | |
| var client = net.connect({port:1337, host:process.env['HOSTNAME']}); | |
| client.on('connect', function(data) { callback(null,client) }); | |
| client.on('error', function() { callback('failed') }); | |
| }; | |
| async.series([produceClient,produceClient,produceClient], |
This file contains hidden or 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
| /* A Saturday afternoon hack project. | |
| * Sort integers from stdin using a binary tree. | |
| * This algorithm is O(n^2) in the worst case though! | |
| */ | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| typedef struct { | |
| int value; |
This file contains hidden or 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
| {-# OPTIONS -Wall #-} | |
| module Main where | |
| import Control.Concurrent (threadDelay) | |
| import System.Environment (getArgs) | |
| import System.INotify | |
| main :: IO () | |
| main = do |
This file contains hidden or 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
| main = mapM_ putStrLn $ take 25 fizzbuzz | |
| fizzbuzz = map (\(f,b) -> f ++ b) $ zip fizzes buzzes | |
| fizzes = map (moddy "fizz" 3) [1..] | |
| buzzes = map (moddy "buzz" 5) [1..] | |
| moddy str b i = if i `mod` b == 0 then str else "" |
This file contains hidden or 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
| ; Use Amazonica from https://github.com/mcohen01/amazonica | |
| (ns com.example | |
| (:use amazonica.aws.ec2 | |
| amazonica.aws.s3 | |
| amazonica.aws.route53)) | |
| (describe-instances) | |
| (list-buckets) | |
| (map :name (list-buckets)) | |
| (list-hosted-zones) |
This file contains hidden or 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
| ; Retrieve a list of buckets. | |
| ; Retrieve the access-control-list. | |
| ; For each, print the owner's display-name. | |
| (ns com.example | |
| (:use amazonica.core | |
| amazonica.aws.s3 | |
| clojure.pprint)) | |
| (defn retrieve-name [bucket] |
This file contains hidden or 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
| APPLE AE P AH L | |
| ORANGE AO R AH N JH | |
| PEAR P EH R | |
| MANDARIN M AE N D ER AH N | |
| GRAPE G R EY P | |
| BANANA B AH N AE N AH |
This file contains hidden or 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
| module.exports = function (n,cb) { | |
| function helper (sum,i) { | |
| if (i == 0) return cb(sum); | |
| else process.nextTick( helper.bind(null,sum*i,i-1) ); | |
| }; | |
| return helper(1,n); | |
| } |