Skip to content

Instantly share code, notes, and snippets.

View teknoraver's full-sized avatar
🖥️
coding

Matteo Croce teknoraver

🖥️
coding
View GitHub Profile
#!/bin/sh
eval $(awk -F':| +' '/^(MemTotal|Cached|Buffers|MemFree)/{print $1"="int($3/1024)}' /proc/meminfo)
for fs in $(awk '/tmpfs/{print$2}' /proc/mounts); do
Cached=$((Cached - $(df -m $fs |awk '!/File system/{print$3}')))
done
exec echo " Total Avail (Cached + Buffers + Free)
$MemTotal $((Cached + Buffers + MemFree)) ($Cached + $Buffers + $MemFree)"
#!/bin/sh
[ -f "$1" ] || exec echo "can't find '$1'"
for i in exiv2 identify; do
which $i >/dev/null || exec "$i is not installed"
done
jpg=/tmp/photosphere-$$.jpg
#!/bin/sh
# Taken from http://dev.gentoo.org/~vapier/clean-patches
# Adapted by me for gsed compatibility
# added binary files and stript first path element by teknoraver
exec sed $sedopt \
-e '/^index /d' \
-e '/^new file mode /d' \
-e '/^Index:/d' \
#!/bin/sh
while true; do
for dev; do
eval read rx_$dev </sys/class/net/$dev/statistics/rx_bytes
eval read tx_$dev </sys/class/net/$dev/statistics/tx_bytes
done
sleep 1
for dev; do
eval read newrx_$dev </sys/class/net/$dev/statistics/rx_bytes
/*
* nokiatagger - a tool to tag mp4 files for Nokia phones
* Copyright (C) 2007 Matteo Croce <[email protected]>
*
* 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, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
#!/bin/sh
{ awk -f /dev/stdin |aplay -r 44100 ; } <<'EOF'
function wl() {
rate = 44100
return (rate / 160) * 2^(-int(rand() * 10) / 5)
}
BEGIN {
srand()
wla = wl()
@teknoraver
teknoraver / io.c
Last active August 18, 2025 12:08
/*
* Simple app. to do memory accesses via /dev/mem.
*
* Copyright (c) Richard Hirst <[email protected]>
* Copyright (c) Thomas Langer <[email protected]>
* Copyright (c) Matteo Croce <[email protected]>
*
*/
#include <stdio.h>
#!/bin/sh
[ -b "$1" ] || exec echo "usage: ${0##*/} <device>"
fs='ext4 btrfs f2fs jfs xfs'
mnt=/tmp/${0##*/}.$$
which bonnie++ >/dev/null || exec echo 'bonnie++ not found'
for i in $fs; do
/*
* Copyright 2015 (C) Matteo Croce <[email protected]>
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
--- a/src/openvpn/options.c
+++ b/src/openvpn/options.c
@@ -4476,7 +4476,17 @@ add_option (struct options *options,
else if (streq (p[0], "tun-ipv6"))
{
VERIFY_PERMISSION (OPT_P_UP);
- options->tun_ipv6 = true;
+ FILE *disable_ipv6 = fopen("/proc/sys/net/ipv6/conf/all/disable_ipv6", "r");
+ if (disable_ipv6)
+ {