Skip to content

Instantly share code, notes, and snippets.

Ján Sáreník jsarenik

Block or report user

Report or block jsarenik

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jsarenik
jsarenik / swap.c
Created Jul 14, 2016
Change endianess (e.g. 01101 to 10110 bit-wise)
View swap.c
#include <stdio.h>
unsigned int reverse(unsigned char b) {
b = (b & 0xF0) >> 4 | (b & 0x0F) << 4;
b = (b & 0xCC) >> 2 | (b & 0x33) << 2;
b = (b & 0xAA) >> 1 | (b & 0x55) << 1;
return b;
}
int
@jsarenik
jsarenik / GNU_Social
Created Jun 14, 2016
[SDF] let SDF help GNU!
View GNU_Social
Date: Sun, 14 Feb 2016 09:53:21 GMT
From: membership@sdf.org
Subject: [SDF] let SDF help GNU!
Want to take back the internet?
No, wait a second. I'm serious. Do you remember a thing called USENET? Do
you remember how cool it was when you posted something and someone at
hawaii.edu or telebit.com responded? GNU Social is reviving this idea. Much
of the internet for the general public these days is not only just focused
on http/https but a key number of central sites. When SDF was (uh, it still
View check.sh
#!/bin/sh
#
# https://tunnelbroker.net/tunnel_detail.php?tid=$TID
TID=1234567
HEUSER=login
HEPASS=Update_Key_from_Tunnel_Details/Advanced
CHECK_DNS=you.dns.he.dynamically.updated.domain
URL="https://$HEUSER:$HEPASS@ipv4.tunnelbroker.net/nic/update?hostname=$TID"
@jsarenik
jsarenik / git-delmerged.sh
Created Dec 15, 2015
Script that deletes all git branches that were already merged to current one
View git-delmerged.sh
#!/bin/sh
git branch --merged | grep -v "^\*\|master" | xargs -r -n 1 git branch -d
View pmd.sh
#!/bin/bash
ifthere() {
for cmd in "$@"
do
type ${cmd%% *} >/dev/null 2>&1 && { $cmd || continue; return $?; }
done
}
usage() {
@jsarenik
jsarenik / rconf.sh
Created Sep 1, 2015
Read file omitting # comments
View rconf.sh
#!/bin/sh
for i in $*
do
grep -v '^#' $i | sed '/^$/d'
done
@jsarenik
jsarenik / keyboard.sh
Created Jun 17, 2015
X Window script to set up keyboard.
View keyboard.sh
#!/bin/sh
setxkbmap ${1:-'dvorak'}
setxkbmap -option ""
xmodmap - <<EOF
! for help, see $ xmodmap -grammar
!in /etc/X11/xorg.conf.d/20-keyboard.conf
! or by running setxkbmap -option "ctrl:nocaps"
@jsarenik
jsarenik / compile-toolchain.sh
Last active Aug 29, 2015
compile-toolchain.sh
View compile-toolchain.sh
#!/bin/sh -ex
#
# $ ls toolchain/src/
# gcc-4.8.4.tar.gz mpc-1.0.3.tar.gz
# gmp-6.0.0a.tar.xz mpfr-3.1.2.tar.gz
# $ cat /etc/debian_version
# 6.0.10
export LC_ALL=C
export LANG=C
@jsarenik
jsarenik / .forward
Created Apr 30, 2015
dotForward file
View .forward
"|IFS=' ' && exec /usr/bin/procmail || exit 75 #jasan"
@jsarenik
jsarenik / .procmailrc
Created Apr 30, 2015
Procmail configuration
View .procmailrc
VERBOSE=on
MAILDIR=$HOME/Mail # elm users might use $HOME/Mail instead
PMDIR=$HOME/.procmail
DEFAULT=/var/spool/mail/jasan
LOGFILE=$PMDIR/log
#SENDMAIL=/usr/sbin/sendmail
#SENDMAILFLAGS=-oi
:0c
* ^To: jasan\+dmarc@.*
You can’t perform that action at this time.