Skip to content

Instantly share code, notes, and snippets.

View bodokaiser's full-sized avatar
😀
Happy to be here!

Bodo Kaiser bodokaiser

😀
Happy to be here!
View GitHub Profile
<html>
<head>
<title>Rechteckt</title>
<script language="Javascript">
function rechne()
{
lang=document.Rechteck.laenge.value;
breit=document.Rechteck.breite.value;
Flaeche=lang*breit;
alert("Die Flächenmaßzahl beträgt " + Flaeche)
@bodokaiser
bodokaiser / multiple_stream_readers.js
Created April 17, 2013 20:15
How could I let multiple readable stream read on a source readable stream?
var stream = require('stream');
var sstream = new stream.Readable();
var rstream1 = new stream.Readable();
var rstream2 = new stream.Readable();
sstream._read = function() {};
rstream1._read = function() {
var chunk = sstream.read();
@bodokaiser
bodokaiser / TerminalScheme.terminal
Created May 4, 2013 07:37
This is my favored Mac OS X Terminal scheme.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BackgroundAlphaInactive</key>
<real>0.20177023121387283</real>
<key>BackgroundBlur</key>
<real>0.60489169034090906</real>
<key>BackgroundColor</key>
<data>
@bodokaiser
bodokaiser / .vimrc
Created May 4, 2013 07:47
This is my vimrc file which enables syntax, column ruler, four spaces auto-indent on all files except for html where I use two spaces.
syntax on
filetype plugin indent on
:set nu
:set cc=80
:set smartindent
:set tabstop=4
:set shiftwidth=4
:set expandtab
autocmd FileType html set tabstop=2 | set shiftwidth=2
@bodokaiser
bodokaiser / Makefile
Last active March 6, 2023 03:51
Example of how to use libuv`s QUEUE.
build:
$(CC) -o queue.o queue.c
@bodokaiser
bodokaiser / pthread_cond.c
Created May 29, 2013 16:17
Incomplete example of using pthreads condition signaling.
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <pthread.h>
pthread_t threads[3];
pthread_cond_t cond_a;
pthread_cond_t cond_b;
@bodokaiser
bodokaiser / pool.c
Last active July 3, 2023 13:42
Simplistic thread pool implementation with pthread and libuv QUEUE
#include "queue.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <pthread.h>
#define THREADS 3
/**
* Task queue.
@bodokaiser
bodokaiser / libuv_tcp_echo_server.c
Last active May 30, 2021 10:10
Simple TCP echo server implemented with libuv.
#include <uv.h>
#include <stdio.h>
#include <stdlib.h>
/**
* Our tcp server object.
*/
uv_tcp_t server;
/**
@bodokaiser
bodokaiser / uvcat.c
Created June 1, 2013 11:20
Implementation of unix program "cat" in libuv.
#include <uv.h>
#include <stdio.h>
/**
* Reference to our event loop.
*/
uv_loop_t * loop;
/**
* Work requests for fs actions.
@bodokaiser
bodokaiser / webserver.c
Created June 1, 2013 13:10
The implementation part of bodokaiser/libuv-webserver.
#include "webserver.h"
/**
* Storage for our buffer with the http response.
*/
static uv_buf_t resp_buf;
/**
* Pointer to libuv event loop.
*/