Skip to content

Instantly share code, notes, and snippets.

View endreszabo's full-sized avatar
💭
I may be slow to respond. Btw I use Arch.

Endre Szabo endreszabo

💭
I may be slow to respond. Btw I use Arch.
View GitHub Profile
#!/bin/bash
# Tmux based TeX editor helper
EDITOR="${EDITOR:-vim}"
DOCUMENT="${1:-deriv}"
SESSIONID="tmuxtexex_${DOCUMENT}_$$"
tmux new-session -d -s "${SESSIONID}" && tmux new-window -t "${SESSIONID}:1" -n 'TmuxTeXEx' "$EDITOR ${DOCUMENT}.tex" && tmux split-window -v -l 6 -t "${SESSIONID}:1" "while :; do inotifywait -e modify \"${DOCUMENT}.tex\" && { make || pdflatex \"${DOCUMENT}.tex\" } && jobs %% || { evince \"${DOCUMENT}.pdf\" & }; done" && tmux select-pane -U -t "${SESSIONID}:1" && tmux -2 attach-session -t "${SESSIONID}"
@endreszabo
endreszabo / backup.sh
Created November 14, 2011 19:43
backup script
#!/bin/bash
set -o nounset
DEST=/mnt/backup/l
INCLUDE=/etc/backup-include
EXCLUDE=/etc/backup-exclude
LOGPATH=/var/log
MAX=100m
#if ! mount | grep -q $DEST; then
@endreszabo
endreszabo / macchange.sh
Created December 15, 2011 00:09
changes mac for fun and profit
#!/bin/sh
if [ "$1" == "wired" ]; then
IFACE=eth0
else
IFACE=wlan0
fi
if [ "$2" == "trusted0" ]; then
MAC="ff:ee:bb:cc:dd:aa"
@endreszabo
endreszabo / dramatic-utf8.pl
Created July 20, 2012 07:06
unicode output dramatic script
#!/usr/bin/env perl
# in irssi you can set off this with /exec -o irc-dramatic.pl <o hai der>
use strict;
use warnings;
use Encode qw/decode/;
binmode(*STDOUT, ":utf8");
$|=1;
my @a=(0x3000,0xff01,0x201d,0xff03..0xff06,0x2019,0xff08..0xff0c,0x2212,0xff0e..0xff5d,0x301c,0xffe5,0xffe2);
@endreszabo
endreszabo / irc-dramatic.pl
Created September 9, 2012 12:30
irc dramatic
#!/usr/bin/env perl
# in irssi you can set off this with /exec -o irc-dramatic.pl <o hai der>
use strict;
use warnings;
use Encode qw/decode/;
binmode(*STDOUT, ":utf8");
$|=1;
my @a=(0x3000,0xff01,0x201d,0xff03..0xff06,0x2019,0xff08..0xff0c,0x2212,0xff0e..0xff5d,0x301c,0xffe5,0xffe2);
@endreszabo
endreszabo / bondup.sh
Created September 10, 2012 19:18
wifi+ethernet bonding
#!/bin/sh
ip link set eth0 down
ip link set wlan0 down
ip link set bond0 down
modprobe bonding mode=1 miimon=100 downdelay=20 updelay=20 use_carrier=1 primary=eth0
dhcpcd -C resolv.conf --noarp --denyinterfaces 'eth0 wlan0' --background
ip link set eth0 up
ip link set wlan0 up
ip link set bond0 up
ifenslave bond0 eth0 wlan0
@endreszabo
endreszabo / foobar.c
Created December 4, 2012 22:02
usin intel's ivy-bridge rdrand hrng
#include <stdio.h>
#include <string.h>
#include "rdrand.h"
#define BUFFSIZE 65536
int main()
{
int r;
@endreszabo
endreszabo / unshorten_bookmarklet.js
Created August 27, 2013 11:02
unshortr url submit bookmarklet
#!/usr/bin/perl
local$/;$_='javascript:'.<DATA>;$_=~s/\) \{\n/){\n/g;$_=~s/\n\s*//g;print;
__DATA__
USSw=open('','unshorten_url_submit','width=400,height=200,scrollbars,resizable,menubar');
OSUl=document.links;
with(USSw.document) {
write('<base target=_self><p>Ushorten Bookmarklet has ');
if(OSUl.length>0) {
write('found the following URLs. Click on any of these to submit to Unshorten delvelopers.</p>');
for(USi=0;USi<OSUl.length;USi++) {
@endreszabo
endreszabo / koponyeg_rss.py
Created November 21, 2013 18:12
koponyeg.hu RSS feedparser hinting
import feedparser
def start_koponyeg_elorejelzes(self, attrsD):
context = self._getContext()
context['koponyeg_elorejelzes_%s' % attrsD['nap']] = attrsD
feedparser._FeedParserMixin._start_koponyeg_elorejelzes = start_koponyeg_elorejelzes
feed = feedparser.parse('http://koponyeg.hu/idojaras_rss.php?regios=1')
@endreszabo
endreszabo / aessss.sh
Created January 20, 2014 22:46
aessss. q&d combination of aes and ssss.
#!/bin/bash
for i in $*; do
HASH=$(openssl dgst -sha256 -binary < "$i" | perl -ne'map{printf("%02x",ord($_))} split//')
KEY=$(dd if=/dev/random bs=1 count=32 | perl -ne'map{printf("%02x",ord($_))} split//')
echo -n "$KEY" | openssl aes256 -aes-256-xts -e -pass stdin -in "$i" -out "${HASH}.bin"
echo -n "$KEY" | ssss-split -x -t 3 -n 4 -w "$HASH" -q | split --lines=1 --numeric-suffixes=1 --suffix-length=1 - "$HASH-"
done