Skip to content

Instantly share code, notes, and snippets.

View synaptiko's full-sized avatar

Jiří Prokop synaptiko

View GitHub Profile
@synaptiko
synaptiko / 8188eu.ko
Last active May 1, 2019 20:23
Useful links related to "hard" linux things when I was experimenting with Raspberry Pi, cross-compilation, emulation etc.
@synaptiko
synaptiko / DomainsNode.js
Created March 11, 2013 05:37
Domains in node used for one request error handling from: http://www.youtube.com/watch?v=tgTniHwGPuM
http.createServer(function(req, res) {
var d = domain.create();
d.add(req);
d.add(res);
d.on('error', function(er) {
console.error('Error', er, req.url);
d.dispose();
});
@synaptiko
synaptiko / Classes.coffee
Last active December 14, 2015 18:38
Two interesting examples from http://ashkenas.com/dotjs/ which I don't know about
# ... with if/else
class Pirate
if century > 1700
loot: ->
say 'Give me the gold!'
else
loot: ->
say 'Dame el oro!'
@synaptiko
synaptiko / qr-code.html
Last active December 14, 2015 11:59
Simple QR code appender. Adds to QR code to page according to content of div with class qr-code.
<meta http-equiv="content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="content-Language" content="cs" />
<style>
div.qr-code {
clear: left;
}
img.qr-code {
float: left;
margin-bottom: 50px;
}
L.Google = L.Class.extend({
includes: L.Mixin.Events,
options: {
minZoom: 0,
maxZoom: 18,
tileSize: 256,
subdomains: 'abc',
errorTileUrl: '',
attribution: '',
#!/bin/bash
DATE=`date +"%Y%m%d%H%M%S"`
INSTALL_DIR=node_${DATE}
mkdir $INSTALL_DIR
cd $INSTALL_DIR
curl http://nodejs.org/dist/node-latest.tar.gz | tar xzv --strip-components=1
export JOBS=2
@synaptiko
synaptiko / mount-sshfs.sh
Last active December 11, 2015 06:18
Simple shell script for un/mounting over SSH. Usage: ./mount-sshf <USER> <SERVER> [kill] It uses xclip command to copy and run command "cd <MOUNTED_DIR>" directly in terminal.
#!/bin/sh
if [ $# -ge 2 ]; then
USER=$1
SERVER=$2
DIR=${MOUNT_SSHFS__ROOT_DIR:-/var/tmp/mount-sshfs}/$SERVER
# it's possible to use primary or clip
XCLIP_SEL_MODE=${MOUNT_SSHFS__XCLIP_SEL_MODE:-primary}
if [ -d $DIR ]; then
if [ $# -eq 3 -a "$3" = "kill" ]; then