Skip to content

Instantly share code, notes, and snippets.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@shashi
shashi / measure.jl
Last active August 29, 2015 14:08
arithmetic for relative length measures
abstract Measure
immutable Length{unit} <: Measure
value::Float64
end
abstract MeasureOp{n} <: Measure
abstract UnaryOp{A} <: MeasureOp{1}
abstract ScalarOp{A} <: MeasureOp{2}
abstract BinaryOp{A, B} <: MeasureOp{2}
@shashi
shashi / eigshow.jl
Created October 25, 2014 18:57
eigshow in Julia
A = [1 3; 4 2] / 4
blue = RGB(0., 0., 9.)
red = RGB(9., 0., 0.)
place(point) = (point .+ 1) ./ 4 .+ .25
drawpoints(points, c) =
[(context(place(points[:, i])..., 0.005, 0.005), fill(c), circle())
for i = 1:size(points, 2)]
@shashi
shashi / sierpinski.elm
Created October 8, 2014 06:37
Sierpinski's triangles in Elm
{- Sierpinski's triangle -}
hscale = sqrt(3) / 2
triangle a =
filled black (path [(-a / 2, -hscale * a / 2),
(a / 2, -hscale * a / 2),
(0, hscale * a / 2)])
sierpinski (x, y) a n =
using AudioIO
macro time_call(ex)
println(ex)
var = gensym()
ex = Expr(:(=), var, ex)
quote
$ex;
AudioIO.pull($var, 44100, 0, 44100);
@time AudioIO.pull($var, 44100, 0, 44100);
def remove_comments(line, pref="", ctx=None, escape=False):
if line == "": return pref
if ctx == "#" and line[0] != '\n':
return remove_comments(line[1:], pref, ctx)
if not ctx:
if line[0] == "#": return remove_comments(line[1:], pref, '#')
for c in ['"""', '"', "'"]:
if line.startswith(c):
# open context
return remove_comments(line[len(c):], pref + c, c)
@shashi
shashi / todo.css
Last active December 22, 2015 02:29 — forked from anonymous/todo.css
/* CSS declarations go here */
.wrapper {
width: 960px;
margin: 10px auto;
}
ul {
list-style: none;
}
@shashi
shashi / Canvas.java
Created April 6, 2012 19:49
Canvas with camera background
// Copyright 2009 Google Inc. All Rights Reserved.
package com.google.appinventor.components.runtime;
import com.google.appinventor.components.annotations.DesignerComponent;
import com.google.appinventor.components.annotations.DesignerProperty;
import com.google.appinventor.components.annotations.PropertyCategory;
import com.google.appinventor.components.annotations.SimpleEvent;
import com.google.appinventor.components.annotations.SimpleFunction;
import com.google.appinventor.components.annotations.SimpleObject;
@shashi
shashi / app_inventor_camera_canvas.diff
Created April 6, 2012 18:49
Canvas with camera background
// Copyright 2009 Google Inc. All Rights Reserved.
package com.google.appinventor.components.runtime;
import com.google.appinventor.components.annotations.DesignerComponent;
import com.google.appinventor.components.annotations.DesignerProperty;
import com.google.appinventor.components.annotations.PropertyCategory;
import com.google.appinventor.components.annotations.SimpleEvent;
import com.google.appinventor.components.annotations.SimpleFunction;
import com.google.appinventor.components.annotations.SimpleObject;
# Python Script to block spammy subscribers from your identi.ca account.
# bug me: identi.ca/g0
import json
import sys
import urllib2
apipath = 'http://identi.ca/api'
username = raw_input('Your username: ')
password = raw_input('Your password: ')