Skip to content

Instantly share code, notes, and snippets.

object BalancedParens {
// some convenient shorthand
def sym(c: Char) = new Symbol[Char](c)
val alnum = new AlphaNumeric()
def many[T: Manifest](p: Parser[Char, T]) = new Many(p)
def option[T, U](l: Parser[Char, T], r: Parser[Char, U]) = new Option(l, r)
val nothing: Parser[Char, Unit] = new Wrapper(())
// our parser; matches expressions of the form (*x)* where the # of parens
#!/usr/bin/python
import os, sys
import subprocess
import readline
from collections import defaultdict
TABSIZE = 2
class TaskDefDict(defaultdict):
def __missing__(self, key):
Network/HTTP/Server.hs:127:7:
Couldn't match expected type `IO b'
against inferred type `Socket -> b1'
In a stmt of a 'do' expression: conn <- socketConnection name sock
In the expression:
do { let name = ppSockAddr addr "";
logInfo lg 0 ("Accepted connection from " ++ name);
conn <- socketConnection name sock;
setStreamHooks
conn
import sbt._
import Keys._
import com.github.retronym.SbtOneJar._
object BuildBroBuild extends Build {
val install = TaskKey[Unit]("install", "Installs the JAR and a launcher script into your homedir")
private def installTask = task {
println("Hello world!")
}
(GeocodeResponse latLng) <- (callJsonEndpoint $ GeocodeEndpoint targetAddress False :: IO GeocodeResponse)
let venuesTrendingEndpoint = VenuesTrendingEndpoint latLng Nothing Nothing `authorizeWith` creds
(VenuesTrendingResponse venues) <- (callJsonEndpoint venuesTrendingEndpoint :: IO VenuesTrendingResponse)
let printVenue v = putStrLn $ "- " ++ name v
mapM_ printVenue venues
-- | Main entry point to the application.
module Main where
import Core
import Endpoint
import FoursquareEndpoint
import FoursquareModel
import GeocoderEndpoint
import GeocoderModel
module Main where
import Core
import Endpoint
import FoursquareEndpoint
import FoursquareModel
import GeocoderEndpoint
import GeocoderModel
targetAddress = "568 Broadway, New York, NY"
#!/bin/bash
for f in *.flac; do
avconv -i "$f" -qscale:a 0 "${f[@]/%flac/mp3}"
done

t is a small wrapper around tmux. Its usage is as follows.

  • t list: List available tmux sessions (equiv to tmux list-sessions).
  • t new NAME: Create a new session with the specified name (equiv to tmux new-session -s NAME).
  • t NAME: Attach to the named session (equiv to tmux attach -t NAME); t attach NAME also works.
  • t (no arguments): Runs tmux attach || tmux which will either attach to the last session or start a new tmux instance.
@wcauchois
wcauchois / machine.js
Created November 19, 2020 15:55
Generated by XState Viz: https://xstate.js.org/viz
const machine = Machine({
id: 'module-net-machine',
on: {
"BLE_CONNECT": [{ actions: [], target: "#ble-connection", },
],
},
initial: 'no-connection',
states: {
"no-connection": {
id: "no-connection",