Skip to content

Instantly share code, notes, and snippets.

View shapr's full-sized avatar
🏃
VENTRE À TERRE

Shae Erisson shapr

🏃
VENTRE À TERRE
View GitHub Profile
@shapr
shapr / HaskellDemo
Created June 27, 2015 22:56
HaskellDemo.hs
module HaskellDemo where
somenumber :: Double
somenumber = 1
somestring = "foo"
somelist :: [Double]
somelist = [1,2,3.0]
Dy MxT MnT AvT HDDay AvDP 1HrP TPcpn WxType PDir AvSp Dir MxS SkyC MxR MnR AvSLP
1 88 59 74 53.8 0.00 F 280 9.6 270 17 1.6 93 23 1004.5
2 79 63 71 46.5 0.00 330 8.7 340 23 3.3 70 28 1004.5
3 77 55 66 39.6 0.00 350 5.0 350 9 2.8 59 24 1016.8
4 77 59 68 51.1 0.00 110 9.1 130 12 8.6 62 40 1021.1
5 90 66 78 68.3 0.00 TFH 220 8.3 260 12 6.9 84 55 1014.4
6 81 61 71 63.7 0.00 RFH 030 6.2 030 13 9.7 93 60 1012.7
7 73 57 65 53.0 0.00 RF 050 9.5 050 17 5.3 90 48 1021.8
8 75 54 65 50.0 0.00 FH 160 4.2 150 10 2.6 93 41 1026.3
@shapr
shapr / HaskellDemo.hs
Created March 7, 2016 17:08
Introduction to Haskell
module Demo where
-- notice many of these don't have type signatures.
-- Haskell is smart enough figure out 99% of the type signatures for you.
-- any type signatures here are just to add clarity.
-- number
somenumber = 1
-- string
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Data.ByteString (ByteString)
import Data.Char (ord)
import Data.Foldable (foldl')
import Data.Word8
import Crypto.Hash
import Crypto.Hash.MD2 as MD2
import Crypto.Hash.MD4 as MD4
@shapr
shapr / Brian.hs
Last active April 26, 2017 15:57
module Main where
import Data.Char
main = do
text <- getContents
let linesList = lines text
let results = map doThing linesList
mapM_ print results
let other = map doOtherThing linesList
module Main where
import System.Process (readProcess, callCommand)
import Data.List (isInfixOf, words)
import Data.List.Split (splitOn)
main = do res <- readProcess "xinput" ["list"] ""
let devices = (filter (isInfixOf "TouchPad") (lines res))
let ids = concatMap (filter (isInfixOf "id=") . words) devices
mapM_ (callCommand . buildDisable) (map delId ids)
@shapr
shapr / hypo.py
Created June 28, 2017 15:03
simple hypothesis demo
from hypothesis import given
import hypothesis.strategies as st
import json
@given(st.one_of( st.integers(), st.text(), st.lists(st.text())))
def test_decode_inverts_encode(s):
assert json.loads(json.dumps(s)) == s
@given(x=st.floats(), y=st.floats(), z=st.floats())
@shapr
shapr / graphql-query.js
Created July 13, 2017 20:48
github enterprise graphql query
{
viewer {
login
name
bio
isHireable
createdAt
}
repository(owner: "owner", name: "reponame") {
pullRequests(last: 20) {
import random
def showbits(n):
return "{0:b}".format(n)
def findnum(n):
rn = random.randrange(0,n)
return (rn, showbits(rn))
def oddbits(s):

Keybase proof

I hereby claim:

  • I am shapr on github.
  • I am shapr (https://keybase.io/shapr) on keybase.
  • I have a public key ASA7FgvzEF2Ut3QWjCrZRiM4hGTsde3eotGWwha3zs2T_wo

To claim this, I am signing this object: