This file contains 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
; Problem 1 | |
(apply + (filter #(or (= 0 (mod % 5)) (= 0 (mod % 3))) (range 1000))) | |
; Problem 2 | |
(defn fib | |
([] (fib 0 1)) | |
([n-2 n-1] | |
(lazy-seq (cons n-1 (fib n-1 (+ n-2 n-1)))))) | |
(reduce + (take-while #(< % 4000000) (filter even? (fib)))) |
This file contains 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
import base64 | |
import hashlib | |
import hmac | |
import simplejson as json | |
def base64_url_decode(inp): | |
padding_factor = (4 - len(inp) % 4) % 4 | |
inp += "="*padding_factor | |
return base64.b64decode(unicode(inp).translate(dict(zip(map(ord, u'-_'), u'+/')))) |
This file contains 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
#!/usr/bin/env ruby | |
# Dave's Tetris clone, Dave Barker 2010 | |
# (Requires rubygame, rsdl, sdl, sdl_graphics, sdl_ttf and ruby >= 1.9) | |
# (Make sure you put Chalkduster.ttf if working directory) | |
# This program is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation, either version 3 of the License, or |
This file contains 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
kzar@discodave:~/iris/iris-protocol-auth$ gem install rice | |
Building native extensions. This could take a while... | |
ERROR: Error installing rice: | |
ERROR: Failed to build gem native extension. | |
/usr/local/rvm/rubies/ruby-1.9.1-p378/bin/ruby extconf.rb | |
checking for a BSD-compatible install... /usr/bin/install -c | |
checking whether build environment is sane... yes | |
checking for a thread-safe mkdir -p... ./install-sh -c -d | |
checking for gawk... no |
This file contains 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
#config/initializers/pretty_json.rb | |
module ActiveRecord | |
class Base | |
def to_json | |
JSON.pretty_generate(as_json) | |
end | |
end | |
end |
This file contains 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
#!/usr/bin/python | |
# Script to send Python scripts to the Round solutions development board | |
# (Designed for use with the GSM862-GPS and RS-EB-S3 Rev 3) | |
# | |
# Idea is that you connect to the Unit through the serial port provided | |
# using the screen command. You then use this script to have the commands | |
# and your code sent to screen automatically. | |
# (For help with screen read this: | |
# http://www.tigoe.net/pcomp/resources/archives/avr/000749.shtml ) |
This file contains 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
# | |
# Script to dump all pyo's on a Telit 862GPS over the serial port as hex. | |
# (Useful as the unit takes SO long to compile .pyo's.) | |
# | |
# | |
# Copyright 2011 Dave Barker | |
# | |
**** MOVED https://github.com/kzar/telit-862-python-tools **** |
This file contains 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
#!/usr/bin/python | |
# Script to write pyo files from dump provided by telit-pyo.py script | |
# - Expects format provided by telit-pyo.py | |
# https://gist.github.com/985401 | |
# - Prepends 'telit-' to file names | |
# - Verifies sizes match what the unit reported before writing | |
# | |
# Copyright 2011 Dave Barker | |
# |
This file contains 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
(ns logs.views.ajax | |
(:import java.net.URL) | |
(:require [logs.views.common :as common] | |
[noir.content.pages :as pages] | |
[net.cgrand.enlive-html :as html] | |
[clj-time.core :as time] | |
[clj-time.format :as time-format]) | |
(:use [clojure.string :only [trim]] | |
[noir.core] | |
[hiccup.core] |
This file contains 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
[Wed, 26 Oct 2011 17:23:23 GMT] [info] [<0.13767.0>] 127.0.0.1 - - 'PUT' /ertoc/2c88db6ce6159cab69e6b007f4000eec?rev=8-aa880aa6de953cf56ce3deb0ab991fe1 201 | |
[Wed, 26 Oct 2011 17:23:25 GMT] [error] [<0.13797.0>] OS Process Error <0.3932.0> :: {os_process_error,{exit_status,0}} | |
[Wed, 26 Oct 2011 17:23:25 GMT] [error] [emulator] Error in process <0.13797.0> with exit value: {{nocatch,{os_process_error,{exit_status,0}}},[{couch_os_process,prompt,2},{couch_query_servers,'-map_docs/2-fun-1-',2},{lists,map,2},{couch_query_servers,map_docs,2},{couch_view_updater,view_compute,2},{couch_view_updater... | |
[Wed, 26 Oct 2011 17:23:25 GMT] [error] [<0.3655.0>] ** Generic server <0.3655.0> terminating | |
** Last message in was {'EXIT',<0.13794.0>, |
OlderNewer