Skip to content

Instantly share code, notes, and snippets.

View dysinger's full-sized avatar
😅
16 hour days is OK. Right?

Dysinger dysinger

😅
16 hour days is OK. Right?
  • Independent
  • Nearby
View GitHub Profile
@dysinger
dysinger / packages.el
Last active January 16, 2021 19:30
Private spacemacs layer to try out Chris Done's Intero mode for haskell
;; 1. place this in ~/.emacs.d/private/intero/packages.el
;; 2. add intero, syntax-checking and auto-completion to your
;; ~/.spacemacs layer configuration & remove the haskell layer
;; if you were using that before
;; 3. make sure you have stack installed http://haskellstack.org
;; 4. fire up emacs & open up a stack project's source files
@dysinger
dysinger / callwords.hs
Created March 26, 2016 19:35
Prints out every dictionary word that could be a FCC ham call sign by replacing the numbers 1,3,4,0 with the letter I,E,A,O
import qualified Data.Char as C
import qualified Data.Set as S
main :: IO ()
main = do
let alpha = ['A' .. 'Z']
leetRegionNum = "IEAO"
oneByOnes =
[[a, n, b] | a <- "KNW"
, n <- leetRegionNum
@dysinger
dysinger / stack-docset.sh
Last active February 5, 2016 08:01
Bash/Zsh function for creating a Dash.app docset from a stack project
function stack-docset
{
# NOTE: This function assumes you already ran `stack build --haddock`
HC_PKG=ghc-pkg
if [ -z $(stack path|grep ghc-package-path|grep -v ghcjs) ]; then HC_PKG=ghcjs-pkg; fi
DOCSET=$(basename $PWD).docset
rm -rf $DOCSET || true
stack build --haddock
stack exec -- haddocset --hc-pkg=$HC_PKG -t $DOCSET create
stack exec -- haddocset --hc-pkg=$HC_PKG -t $DOCSET add $(stack path --local-pkg-db)/*.conf
@dysinger
dysinger / jqplot.hs
Created January 2, 2016 23:40
Trying to call a jquery plugin with ghcjs & ghcjs-jquery
-- .... regular ghcjs & ghcjs-jquery imports
foreign import javascript unsafe
"$.jqplot($1, [[[1, 2],[3,5.12],[5,13.1],[7,33.6],[9,85.9],[11,219.9]]])"
js_jqplot :: JSString -> IO ()
-- .... then in the code to render the page
JQ.ready (js_jqplot "mychart")
@dysinger
dysinger / Vagrantfile
Last active October 6, 2015 11:43
Vagrant AWS config for Haskell projects
# -*- mode: ruby -*-
# vi: set ft=ruby :
# install:
# `vagrant plugin install vagrant-aws`
# `vagrant box add dummy https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box`
# config:
# `export AWS_ACCESS_KEY_ID='...'`
# `export AWS_SECRET_ACCESS_KEY='...'`
# `export AWS_REGION='us-west-2'`
data Person = Person { _name :: String }
data Status a b = New b | Old a b
deriving (Functor,Foldable,Traversable)
type PersonWithStatus = Status Int Person
sumNewFolks :: [PersonWithStatus] -> Int
sumNewFolks = foldr go 0
where go (New _) b = b + 1
@dysinger
dysinger / pulp.log
Created January 12, 2015 23:25
Externs & quoted attributes.
tim@kaku:~/src/ps/purescript-aws% rm -rf output
tim@kaku:~/src/ps/purescript-aws% pulp test
* Building project in /home/tim/src/ps/purescript-aws
* Build successful. Running tests...
(+) should add two numbers and give their sum
100/100 test(s) passed.
* Tests OK.
tim@kaku:~/src/ps/purescript-aws% pulp build
* Building project in /home/tim/src/ps/purescript-aws
Reading ./output/Prelude/externs.purs
@dysinger
dysinger / nixos-binary-ghcjs.md
Last active August 29, 2015 14:12
Bleeding edge binaries of ghcjs & ghc 7.8.4 && cabal-install 1.22 for Nixos
  1. update your /etc/nixos/configuration.nix

    nix.trustedBinaryCaches = [ "https://hydra.nixos.org/" ];

  2. nixos-rebuild (updates /etc/nix/nix.conf)

    nixos-rebuild switch

  3. install ghc/ghcjs/cabal-install

@dysinger
dysinger / coreos-kubernetes-vpc-playbook.yml
Created November 14, 2014 21:40
CoreOS Kubernetes AWS VPC Playbook
---
- connection: local
hosts: 127.0.0.1
tasks:
- local_action:
description: Kubernetes Security Group
module: ec2_group
name: kubernetes
region: '{{ aws.region }}'
rules:
@dysinger
dysinger / aws-cfn-coreos-kubernetes.json
Last active December 6, 2024 10:55
CoreOS Kubernetes on AWS CloudFormation
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "CoreOS on EC2: http://coreos.com/docs/running-coreos/cloud-providers/ec2/",
"Mappings": {
"RegionMap": {
"ap-northeast-1": {
"AMI": "ami-f9b08ff8"
},
"ap-southeast-1": {
"AMI": "ami-c24f6c90"