Skip to content

Instantly share code, notes, and snippets.

Emmanuel Kasper EmmanuelKasper

Block or report user

Report or block EmmanuelKasper

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
@EmmanuelKasper
EmmanuelKasper / wget.js
Last active Aug 8, 2018
Nodejs shell like programming: calling an external command and returning output to stdout
View wget.js
#! env node
// execFileSync will call the command directly without using a shell, a tad faster and prevents interpretation of characters
// ( similar to C and java exec )
const exec = require('child_process').execFileSync;
// inherit will use the stdio of the parent process, ie this nodejs script
exec('wget', ['https://git.kernel.org/torvalds/t/linux-4.18-rc8.tar.gz', '--output-document', '/tmp/bla'], {stdio:'inherit'});
@EmmanuelKasper
EmmanuelKasper / vmake.pl
Created Oct 13, 2017
Make wrapper to execute make file in a sandbox VM
View vmake.pl
#!/usr/bin/perl
use strict;
use warnings;
use English;
use Sys::Virt;
use Net::OpenSSH;
use File::Spec;
use File::Basename;
use Cwd 'realpath';
@EmmanuelKasper
EmmanuelKasper / closure.js
Last active Dec 16, 2016
Closure Example
View closure.js
var loneTalker = {};
var addSpeach = function(name) {
var text = 'Hello ' + name;
var talk = function() {
console.log(text);
};
loneTalker.talk = talk;
};
@EmmanuelKasper
EmmanuelKasper / create_evolution.sh
Last active May 10, 2016
Create an evolution script for the play framework based on pg_dump
View create_evolution.sh
# after that you need to insert # --- !Ups on top of the generated file
echo '# --- !Ups' > conf/evolutions/default/2.sql
# column inserts are needed in case of new model properties
# we keep only the insert statements, pg_dump comments confuse ebean/play
pg_dump --column-inserts \
--inserts --data-only --exclude-table=play_evolutions \
--username popcon -h localhost popcon \
| grep '^INSERT INTO' \
>> conf/evolutions/default/2.sql
@EmmanuelKasper
EmmanuelKasper / add-certs.sh
Last active Feb 14, 2016
Add a self signed certificate to Chrome / Chromium on Linux
View add-certs.sh
#!/bin/sh
# you need to install the libnss3-tools package or equivalent
if [ $# -lt 2 ]; then
echo "Usage: $0 hostname port"
exit 1
fi
hostname=$1
port=$2
View command ouput for debugging lxc snapshot hangs
pct enter 142
ps ax
PID TTY STAT TIME COMMAND
1 ? Ss 0:00 init [2]
831 ? Ss 0:00 /sbin/rpcbind -w
951 ? Ssl 0:00 /usr/sbin/rsyslogd
1025 ? Ss 0:00 /usr/sbin/atd
1071 ? Ss 0:00 /usr/sbin/cron
1086 ? Ss 0:00 /usr/bin/dbus-daemon --system
View gist:b5fff82c06a9287935bf

commands

#client 
iperf -c pf -i 1 -t 60
#server
iperf -s

server side result vr2: VIA VT6105M Rhine III 10/100BaseTX

@EmmanuelKasper
EmmanuelKasper / create_gif.sh
Created Jul 10, 2015
Create gif file with avconf
View create_gif.sh
#export frames
avconv -i hatari.avi -vf fps=10 frames/ffout%03d.png
#assemble frames a gif
convert -loop 0 frames/ffout0*.png new.gif
@EmmanuelKasper
EmmanuelKasper / convert.sh
Last active Jan 13, 2019
Convert images for Atari ST resolution
View convert.sh
# with dithering
convert input.jpg -resize 640x400\! -colorspace gray -colors 2 -normalize output.gif
# without dithering, strong separation
convert input.jpg -resize 640x400\! -colorspace gray +dither -colors 2 -normalize output.gif
# see http://www.multipole.org/discourse-server/viewtopic.php?t=34042 for background
# convert to low resultion for atari ST 16 colors / 4096 palette
convert rio_hill.jpg -colors 16 -depth 4 -resize 320x200\! rio.gif
View ExtJSTips
# show or hide a component by id ( this is an HTML div id)
# <div id="north-region-container" ....
#pkmk
Ext.getCmp('north-region-container').getEl().show();
#pve
Ext.getCmp('content').getEl().show();
# Get store content of a component ( here with id 'mybuilder'
Ext.getCmp('myBuilder').store.data.items
You can’t perform that action at this time.