Skip to content

Instantly share code, notes, and snippets.

View ashaindlin's full-sized avatar

Alex Shaindlin ashaindlin

View GitHub Profile
@EvanHahn
EvanHahn / gist:1135851
Created August 10, 2011 01:46
Tic Tac Toe in Lua. Free license.
--[[
TIC-TAC-TOE
by Evan Hahn (http://www.evanhahn.com/)
This is a program that allows you to play tic-tac-toe against the
computer.
You may change the configuration (below) to make the board more than 3x3,
or play with "white" and "black" instead of "x" and "o", and change how
@shangaslammi
shangaslammi / CustomShow.hs
Created December 27, 2011 19:59
Template Haskell Example
{-# LANGUAGE TemplateHaskell, FlexibleInstances #-}
module CustomShow where
import Language.Haskell.TH
import Data.List (intercalate)
emptyShow :: Name -> Q [Dec]
emptyShow name = [d|instance Show $(conT name) where show _ = ""|]
@leipzig
leipzig / mycd.sh
Created January 21, 2012 03:36
directory based history bash profile
function mycd()
{
#if this directory is writable then write to directory-based history file
#otherwise write history in the usual home-based history file
tmpDir=$PWD
echo "#"`date '+%s'` >> $HISTFILE
echo $USER' has exited '$PWD' for '$@ >> $HISTFILE
builtin cd "$@" # do actual cd
if [ -w $PWD ]; then export HISTFILE="$PWD/.dir_bash_history"; touch $HISTFILE; chmod --silent 777 $HISTFILE;
else export HISTFILE="$HOME/.bash_history";
@waylan
waylan / subprocess_pipe.md
Created April 10, 2012 19:12
Writing to a python subprocess pipe

Here's a few things I tried to write output to a python subprocess pipe.

from subprocess import Popen, PIPE

p = Popen('less', stdin=PIPE)
for x in xrange(100):
    p.communicate('Line number %d.\n' % x)
@martinaglv
martinaglv / spark.js
Last active August 29, 2015 14:04
Sparklines
#!/usr/bin/env node
var ticks = '▁▂▃▄▅▆▇'.split(''),
values = process.argv.slice(2);
var min = Math.min.apply(0, values),
range = Math.max.apply(0, values) - min,
scale = ticks.length - 1;
console.log( values.map(function(x){
@kofemann
kofemann / init-single-node-ceph.sh
Last active October 5, 2020 00:04
Single node CEPH setup
#
# Enable CEPH repos as described at http://ceph.com/docs/master/install/get-packages/#rpm
# Install ceph-deploy package
#
export DATA_DEV=sdb
export JRNL_DEV=sdc
export FS_TYPE=xfs
export CEPH_S_NODE=ceph-s
export CEPH_RELEASE=giant
@queertypes
queertypes / FreeCoFree.hs
Created June 5, 2015 17:11
Exploring Free Monads, Cofree Comonads, and Pairings: DSLs and Interpreters
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-
Explores Free Monads (DSLs) and Cofree Comonads (interpreters) and
their relationship.
Most of the code in this file comes from (1) below. Only minor
modifications are made - semantics are preserved.
@queertypes
queertypes / read-dt.org
Last active March 16, 2024 05:49
Implement a Dependently Typed Language and Then Some
@natevw
natevw / gboard_morse.md
Last active March 26, 2024 09:51
A list of Morse code supported by GBoard Android Keyboard

Morse code supported by GBoard Android Keyboard

Google's GBoard software keyboard has a Morse code mode.

Here's what characters it currently supports:

  • .-a
  • -...b
  • -.-.c
  • -..d