Skip to content

Instantly share code, notes, and snippets.

View jsarenik's full-sized avatar

Ján Sáreník jsarenik

View GitHub Profile
@jsarenik
jsarenik / nginx-configure.sh
Created October 27, 2016 11:58
Configure NGINX with Musl libc
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
@jsarenik
jsarenik / select.sh
Last active December 13, 2020 18:52
Yggdrasil public-peers select
#!/bin/sh
#
# Place this script into public-peers/scripts/select.sh
# chmod a+x public-peers/scripts/select.sh
# Run: cd public-peers/scripts; ./select.sh
PING=ping
printem() {
find .. -mindepth 2 -type f -name '*.md' \
@jsarenik
jsarenik / bitcoin-torrent.sh
Created September 17, 2020 09:18
Script that makes torrent files for bitcoin blocks
#!/bin/sh
BLD=$HOME/.bitcoin/blocks
OUT=$HOME/bitcoin-torrent-out
WH=$HOME/bitcoin-torrent
procdir() {
test -n "$1" || return 1
newdir=${part}
ls $* >/dev/null 2>&1 \
@jsarenik
jsarenik / rawdust-b-gone.md
Created September 16, 2020 15:17
This is a way to get rid of the dust on Bitcoin

Find the transaction you want to get rid of:

listunspent

Note the "address" (for later), "txid" and "vout" lines.

createrawtransaction \
  '[{"txid": "THE_TXID", "vout": VOUT}]' \
  '[{ "tb1qryakg74re8an5yc99nsznj4f7t94rghk6m986l": 0}]'
@jsarenik
jsarenik / isohybrid.pl
Created November 15, 2015 14:37
isohybrid.pl from Syslinux-6.03
#!/usr/bin/perl
## -----------------------------------------------------------------------
##
## Copyright 2002-2008 H. Peter Anvin - All Rights Reserved
## Copyright 2009 Intel Corporation; author: H. Peter Anvin
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, Inc., 53 Temple Place Ste 330,
## Boston MA 02111-1307, USA; either version 2 of the License, or
@jsarenik
jsarenik / busyroot.sh
Last active October 29, 2019 17:33
chroot hack
#!/bin/sh
CHROOT=${1:-"myroot"}
ARCH=${2:-"armv5l"}
test -n "$UNSHARE" || {
export UNSHARE="unshare --fork --pid --mount"
exec $UNSHARE $0 $CHROOT
}
@jsarenik
jsarenik / renameat2.c
Created July 14, 2017 15:09 — forked from eatnumber1/renameat2.c
Command-line tool to call renameat2(2)
#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>
@jsarenik
jsarenik / mtu-linux.sh
Last active June 28, 2017 15:31
Find MTU on Linux as root.
#!/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
@jsarenik
jsarenik / memstat-new.sh
Last active June 18, 2017 16:42
Memstat script rewritten for POSIX shell and busybox tools. Heavily optimized compared to the original one.
#!/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
@jsarenik
jsarenik / args.sh
Created June 9, 2017 06:39
Quoted arguments in shell
for i in $(seq $#)
do
ARGS="$ARGS \"$(eval $(echo echo \$$i))\""
done
echo $ARGS