Skip to content

Instantly share code, notes, and snippets.

class Feedable a b c | b -> a, b -> c where
feed :: [a] -> b -> (b, c)
@avaitla
avaitla / gist:1516620
Created December 24, 2011 06:53
composition of lenses
{-# LANGUAGE TemplateHaskell #-}
import Data.Lens.Template
import Data.Lens.Lazy
data Line = Line {
_lnBeg :: Point
, _lnEnd :: Point
} deriving (Show)
@avaitla
avaitla / server.hs
Created January 31, 2012 09:07
basic snap modified from jaspervdj
{-# LANGUAGE OverloadedStrings #-}
import Data.Char (isPunctuation, isSpace)
import Data.Monoid (mappend)
import Data.Text (Text)
import Control.Exception (fromException)
import Control.Monad (forM_)
import Control.Concurrent (MVar, newMVar, modifyMVar_, readMVar)
import Control.Monad.IO.Class (liftIO)
import qualified Data.Text as T
import qualified Data.Text.IO as T
@avaitla
avaitla / webclient.js
Created January 31, 2012 09:08
client side
function createWebSocket(path) {
var host = window.location.hostname;
if(host == '') host = 'localhost';
// Unsecured
//var uri = 'ws://' + host + ':9160' + path;
// Secured
var uri = 'wss://' + host + ':9160' + path;
@avaitla
avaitla / gencert.sh
Created January 31, 2012 09:19
certificate
#!/bin/bash
# From http://www.akadia.com/services/ssh_test_certificate.html
rm server.key
rm server.csr
rm server.key.org
rm server.crt
openssl genrsa -des3 -out server.key 1024
openssl req -new -key server.key -out server.csr
@avaitla
avaitla / MFCC.py
Created March 21, 2013 00:32
Here is a simple setup that does command recognition and training. Depends on pyaudio, numpy, scipy. Motivated here http://xa.yimg.com/kq/groups/24321415/1523383180/name/Speech_Recognition_seminar.pdf MFCC.py is the mfcc extraction step. audio.py is the main classification system. Main.py is what you want to run on the command line, it does trai…
###############################################################################
# Module for MFCC extraction
# By Maigo Yun Wang, 02/08/2012
###############################################################################
# Quick tutorial:
# import MFCC
# x = ... # x is a wave signal saved in a 1-D numpy array
# mfcc = MFCC.extract(x)
# # mfcc is a 2-D numpy array, where each row is the
# # MFCC of a frame in x
<!DOCTYPE html>
<!-- saved from url=(0046)http://www.paulrhayes.com/experiments/cube-3d/ -->
<html lang="en" id="paulrhayes-com" class="js csstransforms3d csstransitions wf-adobecaslonpro1-n4-active wf-adobecaslonpro1-n7-active wf-swingdancer1-n5-active wf-active"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!-- Hey there, thanks for looking at the source. Skip down until you see the experiment start comments -->
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Paul Hayes: Experiment: 3D CSS cube, use arrow keys to rotate</title>
<meta name="description" content="Use up, down, left and right keys to navigate a 3D cube, built using CSS perspective, transform and transition properties.">
<meta name="keywords" content="css, css3, 3d, cube, webkit, css cube, transition, transform, webkit-transform, webkit-transition, webkit-perspective">
<meta name="author" content="Paul Hayes">
import requests, boto3, base64, hashlib
access_key = "..."
secret_key = "..."
bucket = "..."
s3 = boto3.client('s3',
aws_access_key_id=access_key,
aws_secret_access_key=secret_key)
test_encrypt_key = os.urandom(32)
@avaitla
avaitla / README.md
Last active March 25, 2021 17:27
Broken Hover Background CSS Generation with Tailwind 1.7.6 and Tailwind CSS 0.6.0 (0.5.0 works)

Setup:

$ npm init
$ npm install tailwindcss@1.7.6

Place index.html, tailwind.config.js, postcss.config.js, and styles.css in the same folder.

Run the following which works ✅

Setting up tailwind css the easiest way possible:

$ mkdir simple-tailwind
$ cd simple-tailwind

# We'll put our html templates inside templates/parts
# General config will go in the base of the templates folder
$ mkdir -p templates/parts
$ mkdir static