Skip to content

Instantly share code, notes, and snippets.

Avatar

Philip Woods Elzair

View GitHub Profile
@Elzair
Elzair / build-err.txt
Last active Aug 14, 2017
work-sharing-threadpool-help
View build-err.txt
Compiling playground v0.0.1 (file:///playground)
error[E0308]: mismatched types
--> src/main.rs:62:23
|
62 | mem::swap(datum1.unwrap().1.borrow_mut(),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected &mut _, found struct `std::cell::RefMut`
|
= note: expected type `&mut _`
found type `std::cell::RefMut<'_, std::sync::mpsc::Receiver<bool>>`
= help: try with `&mut datum1.unwrap().1.borrow_mut()`
View git-extract-subdir
#!/usr/bin/env ruby
require 'fileutils'
require 'optparse'
require 'ostruct'
require 'pathname'
require 'pp'
$verbose = false
@Elzair
Elzair / engine-extract.sh
Last active Mar 15, 2017
Unvanquished history merge
View engine-extract.sh
#!/bin/sh
PWD=$(pwd)
FORK_COMMIT="ca388dc0c6bac110254a4e5a175abbb7963b1f4f"
FORK_DATE="Wed Jul 15 22:04:42 2015 +100"
if [ ! -d "Unvanquished" ]
then
echo -e "Cloning full repository"
git clone https://github.com/Unvanquished/Unvanquished.git Unvanquished
@Elzair
Elzair / idx.jl
Created Mar 10, 2015
Julia IDX Parser
View idx.jl
import Base.ntoh
@vectorize_1arg Number Base.ntoh
function readIdx(file_name)
fs = open(file_name, "r")
magic_number = read(fs, UInt8, 4)
if magic_number[3] == 0x08
idx_type = UInt8
elseif magic_number[2] == 0x09
@Elzair
Elzair / hannahci-notes.org
Last active Aug 29, 2015
hannahci presentation
View hannahci-notes.org

Hannah: Comparmentalizing Deployment

Hi, my name is Philip Woods, and I am here today to talk about Hannah.

What is Hannah?

First of all, what is Hannah?

To put it simply, Hannah provides Continuous Integration and Continuous Deployment.

@Elzair
Elzair / preinstall-hannahci-ubuntu.sh
Last active Aug 29, 2015
preinstall-hannahci-ubuntu
View preinstall-hannahci-ubuntu.sh
#!/bin/sh
apt-get install -y build-essential libgmp zlib1g
curl -sSL https://get.docker.com/ubuntu/ | sudo sh -
View haskell-notes.org

Functors

Definition

class Functor f where
  fmap :: (a -> b) -> f a -> f b

Laws

@Elzair
Elzair / scotty.hs
Created Jan 19, 2015
sample-scotty-app
View scotty.hs
{-# LANGUAGE OverloadedStrings #-}
import Data.Monoid (mconcat)
import Network.Wai.Middleware.Static
import Web.Scotty
main = scotty 3000 $ do
middleware $ staticPolicy (noDots >-> addBase "static")
get "/" $ file "static/index.html"
get "/:word" $ do
@Elzair
Elzair / config.hs
Last active Aug 29, 2015
yaml-parser
View config.hs
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE DeriveGeneric #-}
module Config (
MyConfig,
RepositoryConfig,
BranchConfig,
HostConfig,
readConfig
) where
@Elzair
Elzair / bitbucket.hs
Last active Aug 29, 2015
bitbucket-webhook
View bitbucket.hs
{-# LANGUAGE OverloadedStrings #-}
module Bitbucket (
parseHook
) where
import Control.Applicative ((<$>))
import Control.Lens
import Data.Aeson.Lens
import Data.List (nub)