Skip to content

Instantly share code, notes, and snippets.

View 4z3's full-sized avatar
🦀
computering hard

tv 4z3

🦀
computering hard
View GitHub Profile
@4z3
4z3 / gist:790604
Created January 21, 2011 23:01
Temporary queue up messages
// Temporary publish() to queue up messages until connection to Genericore
// is ready.
var publish_queue = [];
var publish_enqueue = function (message) {
publish_queue.push(message);
log('enqueue: ' + publish_queue.length);
};
var publish = publish_enqueue;
@4z3
4z3 / retiolum-subnet-list
Created April 24, 2011 20:54
scrape retiolum's subnet list from syslog[-ng]
#! /bin/sh
set -euf
tempfile=`tempfile`
trap "rm $tempfile" EXIT
inotail -n 0 -f /var/log/syslog.log |
sed -rn '
/tinc\.retiolum/!b
/.*: Subnet list:$/,/.*: End of subnet list\.$/{
@4z3
4z3 / gist:1033129
Created June 18, 2011 14:16
Fix TTY job-control
#? /bin/sh
#
# Fix TTY job-control
#
# source: Internet
#
# Let's try this:
exec </dev/tty1 >/dev/tty1 2>&1
# No, doesn't work: even if opening /dev/tty1 gave sh the ctty,

Keybase proof

{
    "body": {
        "key": {
            "fingerprint": "dfc654d26a794b53e9d2052f6734ac8d34cfa5a8",
            "host": "keybase.io",
            "key_id": "6734ac8d34cfa5a8",
            "uid": "92b9f4e0eef5154d8b59cf82dcb70a00",
            "username": "tv"
@4z3
4z3 / vim.vim
Last active August 29, 2015 14:05
Vim 256-color colorscheme editing config
" show syntax highlight group
fu ShowSyntax ()
let id = synID(line("."), col("."), 1)
let name = synIDattr(id, "name")
let transName = synIDattr(synIDtrans(id),"name")
if name != transName
let name .= " (" . transName . ")"
endif
return name
endfu
@4z3
4z3 / nix-haddock-index.sh
Last active September 4, 2019 06:54
nix-haddock-index.sh
#! /bin/sh
set -euf
# TODO NIX_GHC=$(type -P ghc) NIX_GHC_DOCDIR=$(dirname $(dirname $(type -P ghc)))/share/doc/ghc/html
# if unset: this is for e.g. emse-hdsb
main() {
pkg=$(dirname $(dirname $NIX_GHC))
find -mindepth 1 -maxdepth 1 -type f | while read f1; do f2=$(echo $f1 | tr A-Z a-z); if test "$f1" != "$f2"; then echo mv "$f1" "$f2"; fi; done
@4z3
4z3 / env.nix
Last active August 29, 2015 14:08
env.nix for lftp with custom haskell environment, d3js, and a dedicated histfile
# install with nix-env -f env.nix -i
# start with load-env-projectname
let
name = "projectname";
version = "0.1.0.0";
buildInputs = with pkgs; [
hsEnv
lftp
];
@4z3
4z3 / gist:b0f0a87ee0744b9ea358
Last active August 29, 2015 14:08
enable cgserver on nixos

Following steps can be used to start the cgserver on NixOS:

  1. clone the "cgserver" branch of my nixpkgs repository, e.g.:

    git clone -b cgserver https://github.com/4z3/nixpkgs /tmp/cgserver-nixpkgs

  2. enable the cgserver in the /etc/nixos/configuration.nix by adding:

    services.cgserver.enable = true;

@4z3
4z3 / env.nix
Last active August 29, 2015 14:09
nix development environment example
# usage:
# nix-env -f env.nix -i
# load-env-example-1
#
# If the directory ~/.history/ exists, then the development environment
# will use a dedicated shell history.
#
# Note: this is currently only compatible with nixos-14.11 (nixos-unstable).
#