Instantly share code, notes, and snippets.

View keybase.md

Keybase proof

I hereby claim:

  • I am jsarenik on github.
  • I am jsarenik (https://keybase.io/jsarenik) on keybase.
  • I have a public key ASAJAHQ87yK1i2J4fKG-yJAsyqLsKi5VYj_dH7UnnFossgo

To claim this, I am signing this object:

View renameat2.c
#define _GNU_SOURCE
#include <stdlib.h>
#include <fcntl.h>
#include <stdio.h>
#include <getopt.h>
#include <stddef.h>
#include <stdbool.h>
#include <stdarg.h>
#include <errno.h>
#include <unistd.h>
View mtu-linux.sh
#!/bin/sh -x
PL=1500
myping() {
ping -c1 -w1 -W1 -nM do -s$1 jasan.tk >/dev/null 2>&1
}
until myping $PL; do PL=$(($PL-10)); done
while PL=$((PL+2)); myping $PL; do : ; done
View memstat-new.sh
#!/bin/sh
#Source : http://www.linoxide.com/linux-shell-script/linux-memory-usage-program/
#Parent : http://www.linoxide.com/guide/scripts-pdf.html
tabw=8
mark=40
test $(id -u) -eq 0 || {
echo "This script must be run as root" 1>&2
exit 1
View args.sh
for i in $(seq $#)
do
ARGS="$ARGS \"$(eval $(echo echo \$$i))\""
done
echo $ARGS
View nginx-configure.sh
export PATH=/usr/local/musl/bin:$PATH
sed -i bck 's/configure --disable-shared $PCRE_CONF_OPT/configure --disable-shared --disable-cpp $PCRE_CONF_OPT/' auto/lib/pcre/make
./configure --with-cc="musl-gcc" --with-ld-opt="-static" --with-pcre=$HOME/pcre-8.39 --with-http_v2_module --with-openssl=$HOME/openssl-1.0.2j --without-http_scgi_module --without-http_uwsgi_module --without-http_fastcgi_module
View myip-linux.sh
#!/bin/sh
DEV=$(ip route list | sed -n '/^default/s/.*dev \(\S\+\).*/\1/p')
IP=$(ip route list | sed -n '/^default/s/.*src \(\S\+\).*/\1/p')
ip address list dev $DEV | grep -m1 -o "$IP/[0-9]\+"
View caesar.sh
#!/bin/sh
#
# https://en.wikipedia.org/wiki/Caesar_cipher
KEY=${1:-3}
A=abcdefghijklmnopqrstuvwxyz
B=$(echo $A | cut -b${KEY}- | tr -d '\n'; echo $A | cut -b-$[KEY-1])
AU=$(echo $A | tr '[a-z]' '[A-Z]')
BU=$(echo $B | tr '[a-z]' '[A-Z]')
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
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