Skip to content

Instantly share code, notes, and snippets.

@vi
vi / dbus-shell-service.pl
Created April 5, 2012 02:44
Simple DBUS service that calls your command lines and returns their output
#!/usr/bin/perl -w
# Vitaly "_Vi" Shukela 2012 License=MIT
use strict;
package DbusShellService;
use Net::DBus::Exporter qw(org.vi_server.DbusShellService);
use base qw(Net::DBus::Object);
@vi
vi / mkv2udp.c
Created June 22, 2012 02:16
udp2mkv and mkv2udp
/*
* Read limited subset of matroska files (generated by udp2mkv) and stream them to network as UDP packets
*
* Limitations:
* 1. cluster size is 5 bytes: 08 NN NN NN NN
* 2. Each cluster have only two elements: Timecode and SimpleBlock
* 3. Timecode have size 8 bytes and it is microseconds (timecode scale = 1000)
* 4. SimpleBlock have size as 5 bytes: 08 NN NN NN NN
* 5. There is only one track and it is track number 1
* 6. No lacing
@vi
vi / README
Created September 5, 2012 03:16
Create tun/tap device that just copies all packets to/from the given ethernet interface.
Primary use case: workaround non-working "ip link set wlan0 netns ..." for some network drivers.
Secondary use case: simple demo for getting/setting the MAC address, tun/tap, raw sockets...
Pre-built version: http://vi-server.org/pub/tap_copy
@vi
vi / reedsolomon.c
Created September 16, 2012 16:02
Simple command-line Reed-Solomon encoding and decoding tool
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "ecc.h"
/* Reed-solomon command-line tool by Vitaly "_Vi" Shukela; 2012 */
/*
Usage:
1. Download http://sourceforge.net/projects/rscode/
@vi
vi / uksm_tease.c
Created March 26, 2013 17:15
Test [UKSM][1]: fill up memory pages with the same blocks of random data. [1]:http://kerneldedup.org/en/projects/uksm/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
int main(int argc, char* argv[]) {
if (argc<3) {
fprintf(stderr, "Usage uksm_tease page_size number_of_pages < /dev/urandom\n");
return 1;
}
@vi
vi / y.rs
Last active December 16, 2015 08:49
Y combinator in Rust
/* Y combinator for Rust.
Implemented by Vitaly "_Vi" Shukela.
$ rustc --version
rustc 0.6 (5f13e9c 2013-04-02 13:36:51 -0700)
host: i686-unknown-linux-gnu
*/
type Yfunc<T> = @fn(x:T) -> T;
type Yfunc2<T> = @fn(f: Yfunc<T>, x:T) -> T;
@vi
vi / rondo.pl
Last active December 16, 2015 14:20
Output music from Perl
#!/usr/bin/perl
# Output monophonic Mozart - Rondo Alla Turca to stdout
# Implemented by Vitaly "_Vi" Shukela
# Usage: ./rondo.pl | aplay -f cd
# Used mozk331c.mid as reference
our $vq = 0.2;
71 3
69 3
68 3
69 3
72 12
74 3
72 3
71 3
72 3
76 12
@vi
vi / 0001-contrib-subtree-Implement-graft-parent-option.patch
Created May 7, 2013 02:10
--graft-parent option for `subtree split` contrib script (based on v1.8.3-rc1)
From a0256e3220f90ab74d53680bff87067a8f544ec5 Mon Sep 17 00:00:00 2001
From: Vitaly _Vi Shukela <vi0oss@gmail.com>
Date: Tue, 7 May 2013 05:07:08 +0300
Subject: [PATCH] contrib/subtree: Implement --graft-parent option
---
contrib/subtree/git-subtree.sh | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh
@vi
vi / simplevpn
Last active February 15, 2023 12:20
simplevpn: Simple IPsec and ipip[6] tunnel configuration for Linux using SSH for key exchange
#!/bin/bash
# Setup encrypted IPv4 tunnel over IPv4 or IPv6 on two Linux nodes using SSH for tunnel setup.
# Requires only ipsec-tools, iproute2, ssh and necessry kernel modules locally and remotely.
# Warning: it flushes IPsec settings both locally and remotely.
# Don't use with other IPsec tunnnels.
# Sample usage:
# simplevpn -6 fc::1 fc::2 ssh -T root@fc::2