Skip to content

Instantly share code, notes, and snippets.

View dysinger's full-sized avatar
🏠
Working from home

Dysinger dysinger

🏠
Working from home
  • Independent
  • Oregon | Hawaii | Alaska
View GitHub Profile
@dysinger
dysinger / gist:8760823
Created February 1, 2014 23:40
Idris -> Java Hello World in 6 lines
$ cabal sandbox init
$ cabal install idris
$ echo 'main : IO () ; main = print "hello"' >hello.idr
$ ./.cabal-sandbox/bin/idris --mvn --codegen Java -o hello hello.idr
$ cd hello
$ mvn -DmainClass=hello package shade:shade
$ java -jar target/hello.jar
"hello"
@dysinger
dysinger / idris
Last active August 29, 2015 13:56
HELP I'M NEW TO HASKELL AND CABAL IS KILLING ME!!!
# REMOVE ANYTHING CABAL HAS EVER DROPPED ONTO YOUR SYSTEM
rm -rf ~/.{ghc,cabal}
# UPDATE CABAL
cabal update
# UPGRADE CABAL TO 1.18 (BECAUSE THEY ADDED SANDBOXES)
cabal install cabal-install
export PATH=~/.cabal/bin:$PATH ;# PUT THIS IN YOUR PROFILE
class Falsey a where
false :: a -> Bool
instance Falsey Char where
false _ = False
instance Falsey a => Falsey [a] where
false [] = True
false (x:[]) = false x
false (x:xs) | false x = True
@dysinger
dysinger / docker-ruby-fpm.sh
Last active August 29, 2015 13:56
Stop using rbenv & rvm on servers. plz. kthnx.
cat > Dockerfile <<\EOF
FROM ubuntu:12.04
RUN apt-get update
RUN apt-get install -y ruby1.9.3 build-essential \
libc6-dev libffi-dev libgdbm-dev libncurses5-dev \
libreadline-dev libssl-dev libyaml-dev zlib1g-dev
RUN gem install fpm --bindir=/usr/bin --no-rdoc --no-ri
RUN apt-get install -y curl
RUN curl ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p484.tar.gz|tar oxzC /tmp
WORKDIR /tmp/ruby-1.9.3-p484
(when window-system
(setq exec-path (shell-command ". ~/.bashrc ; echo $PATH")))
@dysinger
dysinger / boto-with-gnu-parallel.md
Last active August 29, 2015 13:56
Boto w/ GNU-Parallel for Reports & Actions

Using Boto & GNU-Parallel Together

For mass destruction (j/k I mean powerful data gathering)

Useful Prelude of Functions

@dysinger
dysinger / lulznpm.log
Created March 1, 2014 03:55
lulz npm
khartes ➤ npm install aws-sdk
npm http GET https://registry.npmjs.org/aws-sdk
npm http GET https://registry.npmjs.org/aws-sdk
npm http GET https://registry.npmjs.org/aws-sdk
npm http 304 https://registry.npmjs.org/aws-sdk
npm http GET https://registry.npmjs.org/xml2js/0.2.4
npm http GET https://registry.npmjs.org/xmlbuilder/0.4.2
npm http 304 https://registry.npmjs.org/xmlbuilder/0.4.2
npm http GET https://registry.npmjs.org/xml2js/0.2.4
npm http GET https://registry.npmjs.org/xml2js/0.2.4
@dysinger
dysinger / Main.idr
Last active August 29, 2015 13:56
Some Errors with the Idris JS Codegen? Am I doing it wrong?
module Main
data Cloud : Type where
AWS : Ptr -> Cloud
data Service : Type where
S3 : Ptr -> Service
amazonCloud : IO Cloud
amazonCloud = mkForeign (FFun "require('aws-sdk');" [] FPtr) >>= return . AWS
@dysinger
dysinger / haskell-to-js.log
Created March 2, 2014 21:51
Reeses Haskell Node.js Cups
➤ cat Main.hs
main :: IO ()
main = putStrLn "hello"
➤ hastec --start=asap --opt-all Main.hs
Compiling Main into .
Linking Main.js
Linking Main
Linking GHC.IO.Handle.Text
Linking Haste.Handle
Linking GHC.Tuple
@dysinger
dysinger / idris-ubuntu-12.04.md
Last active August 29, 2015 13:56
Install Idris (latest) on Ubuntu 12.04

Install GHC & Cabal-Install

apt-get update
apt-get install -y zlib1g-dev libncurses5-dev ghc cabal-install happy alex

Update Cabal-Install

cabal update
cabal install cabal-install

export PATH=$HOME/.cabal/bin:./.cabal-sandbox/bin:$PATH