Skip to content

Instantly share code, notes, and snippets.

Nico Kaiser nicokaiser

Block or report user

Report or block nicokaiser

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@nicokaiser
nicokaiser / rpi-readonly.md
Created Jun 30, 2019
Raspberry Pi with read-only file system
View rpi-readonly.md

Raspberry Pi with read-only file system

Raspbian Buster Lite edition

Here are some very basic steps to make a Raspbian Lite installation read-only (stateless, volatile). This saves write cycles on the SD card and allows the Raspberry Pi to be powered off without shutdown.

Prepare the system

This guide is based on a fresh Raspbian Buster Lite (tested on version June 2019) installation.

View gphoto2-auto-import.py
#!/usr/bin/env python3
from __future__ import print_function
from datetime import datetime
import os
import sys
import time
import tempfile
import shutil
View events.js
function EventEmitter() {
this._events = {};
this._maxListeners = this._maxListeners || undefined;
}
module.exports = EventEmitter;
EventEmitter.prototype.emit = function(type) {
if (!this._events[type]) return false;
View etc-nginx-conf.d-ssl.conf
# ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA;
# ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 24h;
View keybase.md

Keybase proof

I hereby claim:

  • I am nicokaiser on github.
  • I am nicokaiser (https://keybase.io/nicokaiser) on keybase.
  • I have a public key whose fingerprint is 653E FE2F 98D5 3D04 D41C E0F2 8CA2 3480 C02A 6A60

To claim this, I am signing this object:

View client.html
<!DOCTYPE html>
<html>
<head>
<script src="http://autobahn.s3.amazonaws.com/js/autobahn.min.js">
</script>
<script>
// WAMP session object
var sess;
var wsuri = "ws://localhost:9000";
View contents.lens
<koken:load limit="10" infinite="true">
<koken:loop>
<div style="margin:25px auto;">
<koken:link lightbox="true">
<koken:img lazy="true" fade="true" />
</koken:link>
</div>
@nicokaiser
nicokaiser / r.pl
Created Oct 24, 2012
Conversion from Roman to Arabic numerals
View r.pl
#!/usr/bin/perl
$_=shift@ARGV;s/CM/+900/g;s/CD/+400/g;s/XC/+90/g;s/XL/+40/g;s/IX/+9/g;s/IV/+4/g;s/M/+1000/g;s/D/+500/g;s/C/+100/g;s/L/+50/g;s/X/+10/g;s/V/+5/g;s/I/+1/g;eval'print 0'.$_;
@nicokaiser
nicokaiser / r.pl
Created Oct 24, 2012
Conversion from Roman to Arabic numerals
View r.pl
#!/usr/bin/perl
$_=shift@ARGV;s/Mↂ/+9000/g;s/Mↁ/+4000/g;s/CM/+900/g;s/CD/+400/g;s/XC/+90/g;s/XL/+40/g;s/IX/+9/g;s/IV/+4/g;s//+10000/g;s//+5000/g;s/M/+1000/g;s/D/+500/g;s/C/+100/g;s/L/+50/g;s/X/+10/g;s/V/+5/g;s/I/+1/g;/^[0-9\+]*$/ or die;eval'print 0'.$_;
@nicokaiser
nicokaiser / server.js
Created Apr 12, 2012
node http request leak
View server.js
var http = require('http')
, weak = require('weak')
var server = http.createServer(function(req, res) {
if (req.method == 'GET') {
// GET
console.log('GET request')
weak(req, function() { console.log('GET request collected by GC') })
res.end()
You can’t perform that action at this time.