Skip to content

Instantly share code, notes, and snippets.

View rehno-lindeque's full-sized avatar

Rehno Lindeque rehno-lindeque

View GitHub Profile
@rehno-lindeque
rehno-lindeque / scenejs-json-example1.coffee
Created August 25, 2010 07:55 — forked from xeolabs/scenejs-json-example1.js
CoffeeScript version of the JSON scene definition for SceneJS
###
A teapot with an orbiting directional light source that you can rotate with the mouse.
The white dot is not the actual position of the light - it just indicates its direction
relative to the teapot.
Lindsay S. Kay, (CoffeeScript port by Rehno Lindeque)
[email protected]
###
@rehno-lindeque
rehno-lindeque / withoutrenderer.js
Created August 14, 2011 16:29
SceneJS Version 2.0 without renderer node
SceneJS.createScene({
type: 'scene',
id: 'Scene',
canvasId: 'scenejsCanvas',
loggingElementId: 'scenejsLog',
flags:
{
backfaces: false,
},
nodes: [
@rehno-lindeque
rehno-lindeque / withrenderer.js
Created August 14, 2011 16:32
SceneJS Version 2.0 with renderer node
SceneJS.createScene({
type: 'scene',
id: 'Scene',
canvasId: 'scenejsCanvas',
loggingElementId: 'scenejsLog',
flags:
{
backfaces: false,
},
nodes: [
@rehno-lindeque
rehno-lindeque / subgeo.js
Created August 21, 2011 08:14
SceneJS 2.0 SubGeometry test
SceneJS.createScene({
type: 'scene',
id: 'Scene',
canvasId: 'scenejsCanvas',
loggingElementId: 'scenejsLog',
flags:
{
backfaces: false,
},
nodes: [
@rehno-lindeque
rehno-lindeque / Reload.hs
Created May 8, 2012 06:58 — forked from nishimura/Reload.hs
Reloading feature copied from yesod.
{-# LANGUAGE ScopedTypeVariables #-}
--
-- Copied from Yesod
-- see http://www.yesodweb.com/
--
module Reload (main, develLoop) where
-- reload
import Control.Concurrent (forkIO, threadDelay)
import qualified Control.Exception as Ex
@rehno-lindeque
rehno-lindeque / switch_huwai_modem.sh
Created January 10, 2013 08:39
Script to switch a Huawei Modem (E173 I think?) from Mass Storage to Modem in Ubuntu using usb_modeswitch
# Script to switch a Huawei Modem from Mass Storage to Modem in Ubuntu using usb_modeswitch
# (after inserting usb, run repeatedly until device is switched to modem.
# If you wait too long device wont switch and you need to remove it,
# reconnect the usb device and run script again)
# Btw. If you stumble on this while looking for a solution to your Huawei modem problems... There may be better ways:
# https://help.ubuntu.com/community/DialupModemHowto/Huawei
# http://askubuntu.com/questions/179324/huawei-e173-on-ubuntu-12-04
# http://ubuntuforums.org/showthread.php?t=1605484
module.exports = _ = require "lodash"
# Define the function you want to test
# (This is a lodash extension: Structured map over an object using a corresponding dictionary of functions)
_.mixin mapStruct: (obj, fns, defaultFn) ->
defaultFn = defaultFn ? if _.isFunction fns then fns else _.identity
_.zipObject (for k,v of obj then [k, (fns?[k] ? defaultFn) v, k])
@rehno-lindeque
rehno-lindeque / list-maybe-operators.elm
Created March 21, 2014 11:46
Elm Functor/Applicative operator shorthands
-- Shorthand map over List-like
f <$ lx = map f lx -- <$> in Haskell
lx $> f = map f lx
infixr 2 <$
infixr 2 $>
-- Shorthand sequential application
lf <$$ lx = zipWith (\f x -> f x) lf lx -- <*> in Haskell
lx $$> lf = zipWith (\f x -> f x) lf lx -- <**> in Haskell
infixr 1 <$$
@rehno-lindeque
rehno-lindeque / .ghci
Last active August 29, 2015 13:59
Useful REPL utils for Yesod (as well as some generally useful functions!)
:set -i.:config:dist/build/autogen
:set -XCPP -XTemplateHaskell -XQuasiQuotes -XTypeFamilies -XFlexibleContexts -XGADTs -XOverloadedStrings -XMultiParamTypeClasses -XGeneralizedNewtypeDeriving -XEmptyDataDecls -XDeriveDataTypeable
import Prelude
import Control.Applicative
import Data.Char
import Data.List
import qualified Data.Text as T
import Data.Text (Text)
@rehno-lindeque
rehno-lindeque / screen-capture-ubuntu.c
Created July 1, 2014 23:09
Screen capture in ubuntu
// Not mine, politely stolen from http://pastebin.com/cwY9jz7T
// screen-capture-ubuntu.c
// gcc screen-capture-ubuntu.c -o screen-capture-ubuntu `pkg-config --libs --cflags gtk+-2.0`
// http://www.bravegnu.org/gtktext/x498.html
// http://www.cs.dartmouth.edu/~campbell/cs50/project/gtk.html
// http://stackoverflow.com/questions/3124229/taking-a-screenshot-with-c-gtk
// http://stackoverflow.com/questions/11963561/screen-capture-in-haskell?lq=1
// http://askubuntu.com/questions/5847/how-to-resolve-gdk-pixbuf-gdk-pixbuf-h-no-such-file-or-directory
// https://developer.gnome.org/gdk-pixbuf/unstable/gdk-pixbuf-The-GdkPixbuf-Structure.html