Skip to content

Instantly share code, notes, and snippets.

View uho's full-sized avatar

Ulrich Hoffmann uho

View GitHub Profile
@uho
uho / SimpleApp.R
Last active August 29, 2015 13:56
# SparkR [1] version of the Spark quickstart SimplApp example [2]
library(SparkR)
sc <- sparkR.init(master="local")
filter <- function(rdd, pred) { flatMap(rdd, function(x) { if (pred(x)) { list(x) } else { list() } })}
logFile <- "spark-0.9.0-incubating-bin-hadoop2/readme.md"
logData <- textFile(sc, logFile)
@uho
uho / README.md
Created December 2, 2012 20:52 — forked from sma/README.md
A tiny Forth interpreter written in JavaScript plus some descriptions how to use Forth modules with Node.js

Forth für Node.js

Dies ist ein Experiment, das zeigt, wie man ein Modul in einer fremden Sprache in [Node][] laden kann.

Dies ist ein Stück [Forth][]:

: sq ( x -- x² ) dup * ; 3 4 * dup . sq .

Der Programmcode definiert ein neues Wort sq, welches (wie der in runde Klammern eingeschlossene Kommentar erläutert) die oberste auf dem Stack befindliche Zahl quadriert. Danach berechnet es das Produkt von 3 und 4, gibt es aus und quadriert das Ergebnis und gibt auch das aus.

@uho
uho / gist:3847893
Created October 7, 2012 11:10
tcpdump dhcp requests
tcpdump -i eth0 -n port 67 and port 68
@uho
uho / gist:3451894
Created August 24, 2012 15:15
Simple Forth example showing the handling of string and number input/output
20 chars Constant namestring-len
Create namestring namestring-len allot
: input ( buf-addr buf-len prompt-addr promt-len -- buf-add len )
\ prompt user for string
cr type over swap accept ;
: get-age ( -- n )
0.
BEGIN ( d )
@uho
uho / 4e4th
Created July 16, 2012 20:36
Kermit startup file for connecting to 4e4th (http://www.4e4th.eu/)
#!/usr/bin/kermit +
# Kermit startup file for connecting to 4e4th (http://www.4e4th.eu/)
kermit -H -l /dev/ttyACM3
set speed 9600
set reliable
fast
set carrier-watch off
set key \127 \8
set key \96 "\92 bye\4"
set flow-control none
@uho
uho / Makefile
Created July 9, 2012 12:44
Skeleton Makefile to work with SPIN/Promela on the command line
# Skeleton Makefile to work with SPIN/Promela on the command line
SRC=philo.pml
check: ./pan
@rm -f $(SRC).trail
./pan -n
log: $(SRC) $(SRC).trail
spin -t -p $(SRC)