Skip to content

Instantly share code, notes, and snippets.

View ilmoeuro's full-sized avatar

Ilmo Euro ilmoeuro

View GitHub Profile
@ilmoeuro
ilmoeuro / evaluator.rkt
Created June 7, 2013 10:18
Lauseke-evaluaattori käyttäen Racketia (Schemen murre) Käyttö: (infix-eval '(1 + 2 + (3 * 4) / 12))
#lang racket
(require racket/math)
(define (infix-eval expr)
(let ([eval infix-eval]) ; alias
(match expr
; atoms
[(? number?) expr]
['pi pi]
@ilmoeuro
ilmoeuro / gist:8820308
Last active August 29, 2015 13:56
Informal object model (converted to GH flavor)
{-# LANGUAGE ExistentialQuantification #-}

Object model

module Object where
@ilmoeuro
ilmoeuro / httpd.sh
Last active August 29, 2015 14:00
CGI-PHP aware, simple, slow Web server. Requires ncat (in nmap package). HORRIBLY INSECURE, use only at your own risk, and NEVER expose outside!
#/bin/sh
VERSION=1.0
ROOT=`pwd`
PORT=8080
EXEC_NAME="$0"
WORKER=
IFS=`echo -en "\n\b"`
get_ip() {
@ilmoeuro
ilmoeuro / tcpip.md
Last active April 20, 2021 05:49
TCP/IP applications by example

TCP/IP applications by example

In this tutorial we'll implement some simple TCP/IP applications with ncat, bash and some other standard UNIX tools. The principles learned here can be used to implement networking applications in other languages.

The $ or # in front of command line examples denotes the system prompt. Do not type it

@ilmoeuro
ilmoeuro / example.pcb
Created June 15, 2015 07:25
Human-editable PCB layout file example
default unit 100 mil;
pcb {
size 100mm 160mm;
origin 10mm 10mm;
dil 14 {
5 5 12 5;
5 7 12 7;
mark "74HC00";
@ilmoeuro
ilmoeuro / .vimperatorrc
Created October 9, 2015 06:28
My .vimperatorrc
nnoremap h :ba<Enter>
nnoremap j 10j
nnoremap k 10k
nnoremap l :fo<Enter>
"javascript to hide statusbar
noremap <silent> <F8> :js toggle_bottombar()<CR>
noremap : :js toggle_bottombar('on')<CR>:
noremap o :js toggle_bottombar('on')<CR>o
noremap O :js toggle_bottombar('on')<CR>O
public void init() throws InitializationException {
lockActuator.init();
modemController.init();
modemController.addPhoneCallListener((phoneNumber) -> {
eventQueue.offer(new PhoneCallEvent(phoneNumber));
});
}
@Override
@SuppressWarnings("SleepWhileInLoop")
@ilmoeuro
ilmoeuro / example.md
Created June 19, 2016 23:40
Start counting from zero

title

some text

  1. a list
  2. for
  3. programmers
@ilmoeuro
ilmoeuro / valjaat.pde
Created July 23, 2016 16:42
Valjaat kurssilkaisille
double x;
double y;
double aika;
double kirkkaus;
double kyllaisyys;
double savy;
public void setup() {
size(320, 240);
@ilmoeuro
ilmoeuro / ircbot.awk
Last active May 13, 2022 23:43
AWK ircbot, usage: `ncat -c 'awk -v nick=nick -v serv=serv -v chan=chan -f ircbot.awk' <host> <port>`
function message(str) {
system("sleep 0.1");
printf("%s\r\n", str);
printf(">>> %s\n", str) > "/dev/stderr";
system("sleep 0.1");
}
{
printf("<<< %s", $0) > "/dev/stderr";
if (! initialized) {