Skip to content

Instantly share code, notes, and snippets.

View danking's full-sized avatar

Dan King danking

View GitHub Profile
@danking
danking / gist:744556
Created December 17, 2010 06:08
weird error
repl:61
self.stream.write(self.buffered_cmd.length ? '... ' : self.prompt);
^
TypeError: Object [object Object] has no method 'write'
at REPLServer.displayPrompt (repl:61:15)
at new REPLServer (repl:49:8)
at Object.start (repl:56:10)
at Object.<anonymous> (/usr/share/nodejs/node-repl:11:17)
at Module._compile (module:384:23)
at Module._loadScriptSync (module:393:16)
danking@danking-desktop:~ 21:23 $ echo $PYTHONPATH
/home/danking/.python-libraries/:
danking@danking-desktop:~ 21:23 $ python
Python 2.6.6 (r266:84292, Sep 15 2010, 15:52:39)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path
['', '/usr/lib/python2.6', '/usr/lib/python2.6/plat-linux2', '/usr/lib/python2.6/lib-tk', '/usr/lib/python2.6/lib-old', '/usr/lib/python2.6/lib-dynload', '/usr/local/lib/python2.6/dist-packages', '/usr/lib/python2.6/dist-packages', '/usr/lib/python2.6/dist-packages/Numeric', '/usr/lib/python2.6/dist-packages/PIL', '/usr/lib/python2.6/dist-packages/gst-0.10', '/usr/lib/pymodules/python2.6', '/usr/lib/python2.6/dist-packages/gtk-2.0', '/usr/lib/pymodules/python2.6/gtk-2.0']
>>>
Jan 25 21:54 : ffmpeg: failed to open /home/danking/Music/Purity Ring/Ungirthed/Ungirthed.mp3
Format detected only with low score of 24, misdetection possible!
[mp3 @ 0x82b1e90]Header missing
[mp3 @ 0x82b0cf0]Could not find codec parameters (Audio: mp3, 0 channels, s16)
[mp3 @ 0x82b0cf0]Estimating duration from bitrate, this may be inaccurate
Jan 25 21:55 : ffmpeg: Couldn't find stream info
Format detected only with low score of 24, misdetection possible!
[mp3 @ 0x82b3700]Header missing
[mp3 @ 0x82b2560]Could not find codec parameters (Audio: mp3, 0 channels, s16)
[mp3 @ 0x82b2560]Estimating duration from bitrate, this may be inaccurate
(define read-js
(lambda (ch port src line col pos)
(datum->syntax
#f
(->js (read port))
(let-values ([(l c p) (port-next-location port)])
(list src line col pos (and pos (- p pos)))))))
(define js-readtable
(make-readtable #f #f 'non-terminating-macro read-js))
#lang racket
(define define-syntax 'foo)
(define-syntax foo (syntax-rules () ((foo x) (* x x))))
;; Gives:
;; /tmp $ racket bb
;; bb:4:15: compile: unbound identifier in module in: foo
#include<stdio.h>
void main(int argc, char * argv) {
printf("my arguments are:\n");
int i;
for(i=0; i < argc; i++) {
printf("%s", argv[i]);
}
@danking
danking / gist:1068185
Created July 6, 2011 19:55
A very simple example showing how to use Racket's lexing and parsing utilities
#lang racket
(require parser-tools/lex
(prefix-in re- parser-tools/lex-sre)
parser-tools/yacc)
(provide (all-defined-out))
(define-tokens a (NUM VAR))
(define-empty-tokens b (+ - EOF LET IN))
(define-lex-trans number
(syntax-rules ()
@danking
danking / gist:1100360
Created July 22, 2011 20:29
A toy scheme reader
// JS implementation of the Scheme read function, version 2.
// A SExp is either:
// - Atom
// - [ListOf SExp]
//
// An Atom is either:
// - Number
// - Symbol
// - String
In file included from c/syscalls.c:36:
c/cstuff.h:1:22: error: scheme48.h: No such file or directory
In file included from c/syscalls.c:36:
c/cstuff.h:47: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘char_pp_2_string_list’
In file included from c/syscalls.c:40:
c/syscalls.h:3: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘wait_pid’
c/syscalls.h:5: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘scheme_exec’
c/syscalls.h:7: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘scsh_exit’
c/syscalls.h:9: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘scsh__exit’
c/syscalls.h:11: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘scsh_fork’
danking@out-run $ rlwrap sml
Standard ML of New Jersey v110.69 [built: Mon Jun 8 14:15:08 2009]
- CM.make "source.cm"
= ;
[autoloading]
[library $smlnj/cm/cm.cm is stable]
[library $smlnj/internal/cm-sig-lib.cm is stable]
[library $/pgraph.cm is stable]
[library $smlnj/internal/srcpath-lib.cm is stable]
[library $SMLNJ-BASIS/basis.cm is stable]