Skip to content

Instantly share code, notes, and snippets.

View obfusk's full-sized avatar
🏳️‍🌈
hacking ⇒ ¬sleeping 😸

FC (Fay) Stegerman obfusk

🏳️‍🌈
hacking ⇒ ¬sleeping 😸
View GitHub Profile
@obfusk
obfusk / chromium.sh
Created April 18, 2013 22:04
run chromium twice
chromium-browser --user-data-dir=$HOME/tmp/chromium-test
@obfusk
obfusk / README.md
Last active October 17, 2021 12:35
building chromium (on ubuntu 12.04) w/ extra ffmpeg codecs

VM

$ mkdir -p ~/tmp/build/chromium-vagrant && cd ~/tmp/build/chromium-vagrant
$ vim Vagrantfile

$ vagrant up && vagrant halt
# use virtualbox to add 20GB swap (/dev/sdb)

$ vagrant up && vagrant ssh
@obfusk
obfusk / openelec-install.bash
Created May 22, 2013 22:40
Manual Installation of OpenELEC for Raspberry Pi on SD card
# === Manual Installation of OpenELEC for Raspberry Pi on SD card ===
#
# Adapted from create_sdcard of OpenELEC-RPi.arm-3.0.3.
# Run in OpenELEC-RPi.arm-3.0.3/.
#
# === IMPORTANT ===
#
# These instructions assume your SD card is at /dev/sdb; replace
# as appropriate.
# This will wipe any data off your chosen drive.
@obfusk
obfusk / README.md
Last active December 17, 2015 17:38
test VM: vagrant, etckeeper, postgresql, mongodb, ...

[]: {{{1

File        : README.md
Maintainer  : Felix C. Stegerman <[email protected]>
Date        : 2013-05-25

[]: }}}1

Host

[]: {{{1

@obfusk
obfusk / canonpath.bash
Last active December 17, 2015 17:39
bash functions (hereby public domain)
# Usage: canonpath <path>
# No physical check on the filesystem, but a logical cleanup of a
# path.
# Uses perl.
function canonpath ()
{ perl -MFile::Spec -e 'print File::Spec->canonpath($ARGV[0])' "$1"; }
@obfusk
obfusk / authorized_keys
Last active November 20, 2021 17:25
ssh restricted commands
command="./ssh-cmd.bash",no-agent-forwarding,no-port-forwarding,no-pty,no-X11-forwarding ssh-rsa ...KEY... user@host
@obfusk
obfusk / README.md
Last active December 17, 2015 20:09
vagrant + nginx + ssl

Certificate

$ openssl req -x509 -newkey rsa:2048 -keyout key.pem \
  -out cert.pem -days 360 -nodes

Packages

vm$ aptitude install nginx-full vim

Nginx

@obfusk
obfusk / README.md
Last active December 17, 2015 22:19
dnsmasq for internal network

Install on dev server

$ aptitude install dnsmasq

Wildcards

$ cat >> /etc/dnsmasq.d/dev  # choose any name
address=/dev.example.com/192.168.1.2
^D
@obfusk
obfusk / README.md
Last active December 18, 2015 10:19
vagrant base box: precise64-flx

[]: {{{1

File        : README.md
Maintainer  : Felix C. Stegerman <[email protected]>
Date        : 2013-06-12

[]: }}}1

This README describes how I created a precise64-flx vagrant base box. It is meant to be more secure and contain some useful tools.

@obfusk
obfusk / head-and-tail.bash
Last active December 19, 2015 09:49
head+tail with perl
# One-line version of head-and-tail.plx (w/o --no-overlap and w/o
# proper handling of tail less than number of lines):
seq 1 100000 | HEAD=5 TAIL=2 SEP=$'...\n' perl -e 'my($h,$t,$s,$l)=($ENV{"HEAD"}||10,$ENV{"TAIL"}||10,$ENV{"SEP"}||"",0);my @b=();while(<>){print if $.<=$h;$b[$.%$t]=$_;$l=$.};print $s;for(my $i=$t-1;$i>=0;--$i){print $b[($l-$i)%$t]}'
# For files (not streams), this seems to work just fine too (but it
# will not overlap):
( head -n 5; echo ...; tail -n 2 ) < some-file