Skip to content

Instantly share code, notes, and snippets.

@bytezen
bytezen / decode.md
Created September 2, 2017 14:28 — forked from yang-wei/decode.md
Elm Json.Decode tutorial and cheatsheet

When receiving JSON data from other resources(server API etc), we need Json.Decode to convert the JSON values into Elm values. This gist let you quickly learn how to do that.

I like to follow working example code so this is how the boilerplate will look like:

import Graphics.Element exposing (Element, show)
import Task exposing (Task, andThen)
import Json.Decode exposing (Decoder, int, string, object3, (:=))

import Http
@bytezen
bytezen / as_keith_midi.xtm
Created May 12, 2017 17:53 — forked from CircuV/as_keith_midi.xtm
Transscript of live performance based on Andrew Sorensen "A Study in Keith"
;;; as_keith_midi.xtm -- live performance
;; based on Andrew Sorensen "A Study in Keith" Impromptu performance
;; "A Study In Keith" is a work for solo piano (NI's Akoustik Piano)
;; by Andrew Sorensen inspired by Keith Jarrett's Sun Bear concerts.
;; Orginal code transposed to Extempore
;; http://extempore.moso.com.au
;;
;; Author: cv
;; Keywords: extempore, live-coding, impromptu, keith jarret
@bytezen
bytezen / talk.md
Created April 13, 2017 15:29 — forked from rbnpi/talk.md
Bett Show 2015 talk

Sonic Pi 2.2 at Bett 2015

This is a summary of a talk given at Bett 2015 on Sonic Pi

I started by playing excerpts from two programs, Scott Joplin Maple Leaf Rag, and a Percussion Generator, to illustrate different things Sonic Pi can do, and gave a brief description of Sonic Pi and the user interface, similar to section 1.2 of the built in tutorial, which is accessed by clicking the Help button.

I also showed how one of the example programs "Idm Breakout" could be copied and played. Then I used the following program sections to develop a code to play the round Frere Jaques

##Making sounds

@brysonian
brysonian / Mounting Raspberry Pi Drive via Vagrant.md
Created February 24, 2017 08:25
Mounting Raspberry Pi Drive via Vagrant

#Mounting Raspberry Pi Drive via Vagrant

Install Vagrant

Find instructions here Vagrant. Probably not a bad idea to run the getting started and make sure it works.

Identify your USB device

With your pi drive mounted (e.g. via a microsd reader) run VBoxManage list usbhost. This will print a list of UDB devices available to VirtualBox. Look for one that matches your device, this will probably have a manufacturer name of "Generic". Once you find it, note the VendorId and ProductId.

Configure Your Vagrant Project

Make a new directory and run vagrant init. This will create a Vagrantfile. Open this in a text editor and replace everything with this:

@wassname
wassname / permutations.js
Last active June 28, 2022 22:53
Combinatorics permutatons and product in javascript using lodash.js (like python's itertools)
/**
* Lodash mixins for combinatorics
* by: wassname & visangela
* url: https://gist.github.com/wassname/a882ac3981c8e18d2556/edit
* lodash contrib issue: https://github.com/node4good/lodash-contrib/issues/47
* lic: same as lodash
* Inspired by python itertools: https://docs.python.org/2.7/library/itertools.html
*
* Usage:
* permutations([0,1,2],2) // [[0,1],[0,2],[1,0],[1,2],[2,0],[2,1]]
@Kirubaharan
Kirubaharan / mailmerge.py
Created November 5, 2015 11:15
This simple python Mail Merge script accepts .xlsx, .xls, and .csv files as the list input. The list input is assumed to have a header row with nickname in the first column and email in the second column. This header row will be skipped during processing. Below the header row the appropriate nickname/email combinations should be listed. The emai…
import getpass
import csv
import smtplib
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMEText
import xlrd
import xlwt
import re
from time import sleep
@CircuV
CircuV / as_keith_midi.xtm
Created May 12, 2015 11:28
Transscript of live performance based on Andrew Sorensen "A Study in Keith"
;;; as_keith_midi.xtm -- live performance
;; based on Andrew Sorensen "A Study in Keith" Impromptu performance
;; "A Study In Keith" is a work for solo piano (NI's Akoustik Piano)
;; by Andrew Sorensen inspired by Keith Jarrett's Sun Bear concerts.
;; Orginal code transposed to Extempore
;; http://extempore.moso.com.au
;;
;; Author: cv
;; Keywords: extempore, live-coding, impromptu, keith jarret
@staltz
staltz / introrx.md
Last active July 15, 2024 15:43
The introduction to Reactive Programming you've been missing
@whatnickcodes
whatnickcodes / base64.js
Created April 24, 2014 15:01
How to Encode and Decode Strings with Base64 in JavaScript
// Create Base64 Object
var Base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(e){var t="";var n,r,i,s,o,u,a;var f=0;e=Base64._utf8_encode(e);while(f<e.length){n=e.charCodeAt(f++);r=e.charCodeAt(f++);i=e.charCodeAt(f++);s=n>>2;o=(n&3)<<4|r>>4;u=(r&15)<<2|i>>6;a=i&63;if(isNaN(r)){u=a=64}else if(isNaN(i)){a=64}t=t+this._keyStr.charAt(s)+this._keyStr.charAt(o)+this._keyStr.charAt(u)+this._keyStr.charAt(a)}return t},decode:function(e){var t="";var n,r,i;var s,o,u,a;var f=0;e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");while(f<e.length){s=this._keyStr.indexOf(e.charAt(f++));o=this._keyStr.indexOf(e.charAt(f++));u=this._keyStr.indexOf(e.charAt(f++));a=this._keyStr.indexOf(e.charAt(f++));n=s<<2|o>>4;r=(o&15)<<4|u>>2;i=(u&3)<<6|a;t=t+String.fromCharCode(n);if(u!=64){t=t+String.fromCharCode(r)}if(a!=64){t=t+String.fromCharCode(i)}}t=Base64._utf8_decode(t);return t},_utf8_encode:function(e){e=e.replace(/\r\n/g,"\n");var t="";for(var n=0;n<e.length;n++){var r=e.charCodeAt(n);if(r
@mikesmullin
mikesmullin / watch.sh
Last active April 26, 2023 05:20
watch is a linux bash script to monitor file modification recursively and execute bash commands as changes occur
#!/usr/bin/env bash
# script: watch
# author: Mike Smullin <mike@smullindesign.com>
# license: GPLv3
# description:
# watches the given path for changes
# and executes a given command when changes occur
# usage:
# watch <path> <cmd...>
#