Skip to content

Instantly share code, notes, and snippets.

{$mode delphi}
unit uAST; // abstract syntax tree for simple interpreter
interface uses classes, sysutils, variants;
type
TSyntax = variant;
TExpr = variant;
TBoolExpr = variant;
TStmt = variant;
TIfStmt = variant;
;;; oberon.el --- major mode for editing oberon source in Emacs
;; Copyright (C) 1993, 94, 95, 96, 97, 98, 1999, 2000 Free Software Foundation, Inc.
;; Copyright (C) 2003 Aaron Isotton. Based on Espen Skoglund's pascal-mode.
;; I wrote this not because I think that Oberon is a good (or even
;; usable) language, but because at ETHZ we're forced to use it. So
;; at least I can use emacs to edit the sources. Oberon is evil and
;; sucks.
;;; oberon.el --- Major mode for editing Oberon/Oberon-2 program texts
;; Copyright (C) 2006 Karl Landström
;; Author: Karl Landström <karl@karllandstrom.se>
;; Maintainer: Karl Landström <karl@karllandstrom.se>
;; Version: 2.0 Beta 1
;; Keywords: oberon oberon-2 languages oop
;; This file is free software; you can redistribute it and/or modify
M j/parity.ijs
M j/thing.ijs
M lua/makenodes.lua
M nial/nialogic.ndf
M pascal/callj.ijs
M pascal/hipy.sh
?? haskell/darkf-wordwrap-a.hs
?? haskell/darkf-wordwrap-b.hs
?? haskell/lampibound.hs.org
?? j/ackgolf.ijs.org
# download latest libevent2 and tmux sources, and extract them somewhere
# (thx bluejedi for tip on latest tmux URL)
#
# at the time of writing:
# https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
# http://sourceforge.net/projects/tmux/files/latest/download?source=files
#
# install deps
yum install gcc kernel-devel make ncurses-devel
#!/usr/bin/env python2.7
import pprint as pp
import pyjsonrpc as pj # pip-2.7 install python-jsonrpc
h=pj.HttpClient(url="http://gbt.mining.eligius.st:9337/",username="x",password="x")
d=h.call("getblocktemplate",id=0)
pp.pprint(d)
@tangentstorm
tangentstorm / loop-a.c
Last active August 29, 2015 14:19
which of these two programs would you expect to run faster... and why?
#include<stdio.h>
int main() {
unsigned long sum = 0;
for (unsigned long i=0; i<=4294967295; i++) sum++;
printf("%lu\n", sum);
}
@tangentstorm
tangentstorm / patmatch.ijs
Created April 15, 2015 15:31
pattern matching code in j!
NB. since the 'case' clauses are evaluated dynamically,
NB. you can use them to create something similar to pattern
NB. matching in erlang/prolog/haskell:
ite =: verb define
select. 'f g h' =. y
case. 1,g,h do. g
case. 0,g,h do. h
case. f,1,0 do. f
case. do.
@tangentstorm
tangentstorm / Flicker.cs
Created July 13, 2015 15:24
A flickering light behavior for unity.
using UnityEngine;
using System.Collections;
public class FlickerBehavior : MonoBehaviour {
// the (comparatively) steady light phase
public float minLightMs = 500;
public float maxLightMs = 5000;
// dark part of the flicker phase:
# a tiny assembler
module 'asm'
imports [ 'vm', 'mr' ], ->
# instruction formats:
fm0 = 0
fm1 = 1 << 30
fm2 = 2 << 30
fm3 = 3 << 30