Skip to content

Instantly share code, notes, and snippets.

@vi
vi / Makefile
Last active Aug 29, 2015
I2P daily graph extraction framework
View Makefile
#wget 'http://127.0.0.1:7657/viewstat.jsp?stat=tunnel.participatingTunnels&showEvents=false&period=60000&periodCount=1500&end=1744&width=2400&height=600' -O 2014-03-01.png
INITIAL_DAY=2014-01-28
WIDTH=1200
HEIGHT=600
ADDR=http://127.0.0.1:7657
DATE_NOW=$(date -u +'%Y-%m-%d')
@vi
vi / bupsplitfixup
Created Apr 8, 2014
bup: Script to convert a result of pre-"bup-split-to-vfs-file" `bup split` into a FUSE-accessible "data" file.
View bupsplitfixup
#!/bin/bash
FROM="$1"
TO="$2"
if [[ -z "$FROM" || -z "$TO" ]]; then
echo "bupslitfixup - convert \"bup split\"-generated content into a form suitable for \"bup fuse.\""
echo "Note: \"bup-split-to-vfs-file\" patch makes \"bup split\" to save content in such form automatically."
echo "Usage: bupsplitfixup treeish_to_be_fixed branch_name_to_create"
echo "Example: bup split -n qqq < something.dat; bupsplitfixup qqq qqq_fixed"
echo "Note: Existing ref with branch_name_to_create is overwritten"
@vi
vi / wilson.pl
Last active Aug 29, 2015
Simple Perl script for playing with formula from http://www.evanmiller.org/how-not-to-sort-by-average-rating.html
View wilson.pl
#!/usr/bin/perl -wln
# Calculate lower and upper bounds of Wilson confidence interval based on upvotes and downvotes
# Based on SQL expression from http://www.evanmiller.org/how-not-to-sort-by-average-rating.html
# Confidence parameter is hardcoded at 95%
# Each input line is two numbers: number_of_upvotes <whitespace> number_of_downvotes
# Each output line is two numbers: minimal_estimated_ratio_of_upvoters <space> maximal_estimated_ratio_of_upvoters
@vi
vi / pseudohdr.sh
Created Jun 9, 2014
ImageMagick-based pseudo-HDR merger script
View pseudohdr.sh
#!/bin/bash
# Photos must be perfectly aligned
# Warning: slow
# Created by amateur, don't expect much.
k=0
D=pseudohdr_data
@vi
vi / simple_debianize
Created Jun 29, 2014
Simple one-step crude debianizator for my sole-executable-file Github projects
View simple_debianize
#!/bin/bash
if [ -z "$3" ]; then
echo "Usage: simple_debianize name initial_version executable_name"
exit 1
fi
set -e
NAME="$1"
View cat_and_follow
#!/bin/bash
if [[ -z "$1" || "$1" == "--help" ]]; then
echo "Ouput content of the file being appended to to stdout, continue outputting as more data appears in the file, exit when no processes write to the file for a while."
echo "Usage: cat_and_follow file | something"
exit 1
fi
F="$1"
@vi
vi / gist:cc46cf95cd5b44f7964b
Last active Aug 29, 2015
Gdb backtrace of crashing Enki
View gist:cc46cf95cd5b44f7964b
This file has been truncated, but you can view the full file.
Thread 29 (Thread 0xe533db40 (LWP 24751)):
#0 0xf7e666b1 in poll () at ../sysdeps/unix/syscall-template.S:81
No locals.
#1 0xf71d413b in g_poll (fds=0xf1308090, nfds=2, timeout=-1) at /build/buildd-glib2.0_2.33.12+really2.32.4-5-i386-eISom6/glib2.0-2.33.12+really2.32.4/./glib/gpoll.c:132
No locals.
#2 0xf71c59f0 in g_main_context_poll (n_fds=2, fds=0xf1308090, timeout=<optimized out>, context=0xf13062f8, priority=<optimized out>) at /build/buildd-glib2.0_2.33.12+really2.32.4-5-i386-eISom6/glib2.0-2.33.12+really2.32.4/./glib/gmain.c:3440
poll_func = <optimized out>
#3 g_main_context_iterate (context=context@entry=0xf13062f8, block=block@entry=1, dispatch=dispatch@entry=1, self=<error reading variable: Unhandled dwarf expression opcode 0xfa>) at /build/buildd-glib2.0_2.33.12+really2.32.4-5-i386-eISom6/glib2.0-2.33.12+really2.32.4/./glib/gmain.c:3141
@vi
vi / gist:8c6ac53821fd74def0e0
Created Sep 30, 2014
Attempting to use a Haskell package in Nix
View gist:8c6ac53821fd74def0e0
# su -l nix
nix@vi-notebook:~$ nix-shell -p haskellPackages.ftphs --option use-binary-caches false
\[\][nix-shell:~]$\[\] ghci -v
GHCi, version 7.8.3: http://www.haskell.org/ghc/ :? for help
Glasgow Haskell Compiler, Version 7.8.3, stage 2 booted by GHC version 7.4.2
Using binary package database: /nix/store/d3mchqnyysryxdyzfcgm24dn5kki6bx8-ghc-7.8.3/lib/ghc-7.8.3/package.conf.d/package.cache
Using package config file: /home/nix/.nix-profile/bin/../lib/ghc-7.8.3/package.conf.d/aeson-0.8.0.0.installedconf
Using package config file: /home/nix/.nix-profile/bin/../lib/ghc-7.8.3/package.conf.d/aeson-pretty-0.7.1.installedconf
Using package config file: /home/nix/.nix-profile/bin/../lib/ghc-7.8.3/package.conf.d/asn1-encoding-0.8.1.3.installedconf
@vi
vi / 0000-README.md
Last active Aug 29, 2015
rRootage red-blue recolouring patch
View 0000-README.md

Intro

Playing STG requires to consider two objects: projectiles and player. This patch changes colours of objects in rRootage: player is red, projectiles are blue. This way, using anaglyph glasses, each eye sees only one of two requires thigs, which adds a bit of difficulty.

Inspired by idea of Lazy Eye Tetris.

Usage

@vi
vi / genetic_regex.pl
Created Nov 24, 2014
Generate regular expressions using genetic algorithm.
View genetic_regex.pl
#!/usr/bin/perl -w
use strict;
$|=1;
if ($#ARGV != 3) {
print STDERR "Usage: genetic_regex.pl file_with_passing_lines file_with_failing_lines {file_with_hints|''} {file_with_bans|''} \n";
print STDERR "Created by Vitaly '_Vi' Shukela, in 2014. License is LGPLv2+.\n";
exit 1;
You can’t perform that action at this time.