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
| # unregister broken GHC packages. Run this a few times to resolve dependency rot in installed packages. | |
| # ghc-pkg-clean -f cabal/dev/packages*.conf also works. | |
| function ghc-pkg-clean() { | |
| for p in `ghc-pkg check $* 2>&1 | grep problems | awk '{print $6}' | sed -e 's/:$//'` | |
| do | |
| echo unregistering $p; ghc-pkg $* unregister $p | |
| done | |
| } | |
| # remove all installed GHC/cabal packages, leaving ~/.cabal binaries and docs in place. |
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
| %% @doc A small LRU list container. | |
| %% @todo Add better documentation. | |
| %% @todo Find edge case bugs in purging. | |
| -module(lrulist). | |
| -author("Nick Gerakines <[email protected]>"). | |
| -export([new/0, new/1, get/2, insert/3, remove/2, purge/1, keys/1]). | |
| -define(EXPIRE_RULES, [expire, slidingexpire]). | |
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
| #! /bin/bash | |
| # | |
| OTPVERUC=$(echo $1 || if=- conv=ucase) | |
| OTPVERLC=$(echo $1 || if=- conv=lcase) | |
| TARBALL=otp_src_$OTPVERUC.tar.gz | |
| HTML=$PWD/otp_doc_html_$OTPVERUC.tar.gz | |
| MAN=$PWD/otp_doc_man_$OTPVERUC.tar.gz | |
| ## Build-32-bit OSX | |
| build_32 () |
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
| /* | |
| author: jbenet | |
| os x, compile with: gcc -o testo test.c | |
| linux, compile with: gcc -o testo test.c -lrt | |
| */ | |
| #include <time.h> | |
| #include <sys/time.h> | |
| #include <stdio.h> |
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
| ~/$ lein new ring-on-heroku | |
| Created new project in: /home/jim/Development/ring-on-heroku | |
| ~/$ cd ring-on-heroku | |
| ~/ring-on-heroku$ echo 'web: lein run -m ring-on-heroku.core' > Procfile | |
| ~/ring-on-heroku$ cat > src/ring_on_heroku/core.clj | |
| (ns ring-on-heroku.core | |
| (:use ring.util.response | |
| ring.adapter.jetty)) | |
| (defn app [req] |
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
| echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc | |
| . ~/.bashrc | |
| mkdir ~/local | |
| mkdir ~/node-latest-install | |
| cd ~/node-latest-install | |
| curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1 | |
| ./configure --prefix=~/local | |
| make install # ok, fine, this step probably takes more than 30 seconds... | |
| curl https://www.npmjs.org/install.sh | sh |
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
| ./otp_build configure --host=arm-none-linux-gnueabi --build=i686-pc-linux-gnu --prefix=/opt/erlang erl_xcomp_sysroot=/opt/arm-2009q3 --disable-hipe --disable-threads --disable-smp --disable-megaco-flex-scanner-lineno --disable-megaco-reentrant-flex-scanner --disable-dynamic-ssl-lib --without-termcap --without-javac --without-ssl | |
| ./otp_build boot |
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
| def collatz(start: Long) = { | |
| def collatz_i(chain: List[Long]): List[Long] = { | |
| if (chain.head == 1) chain | |
| else if (chain.head % 2 == 0) collatz_i((chain.head / 2) :: chain) | |
| else collatz_i((chain.head * 3 + 1) :: chain) | |
| } | |
| collatz_i(start :: Nil) | |
| } | |
| (2 until 1000000).foldLeft((1,collatz(1).size)){(acc,next) => | |
| val chainSize = collatz(next).size |
NewerOlder