Skip to content

Instantly share code, notes, and snippets.

View idnovic's full-sized avatar
🔐
keeping things secure

Ivo Damjanović idnovic

🔐
keeping things secure
View GitHub Profile
@idnovic
idnovic / numbers.php
Created March 13, 2023 23:00 — forked from bzikarsky/numbers.php
Codegolf: Convert numbers up to 999'999 into german numbers
Minified, 411 Bytes, with umlauts
Run with `php -d display_errors=Off` to hide DEPRECATED errors on 5.3
See OO-Version at <https://gist.github.com/750787>
<?function n($n,$a=0){$e=array(2=>'zwan','dreißig')+$d=split(':',':ein:zwei:drei:vier:fünf:sech:sieb:acht:neun:zehn:elf:zwölf');$t=$n%10;return$n<1000?($n<100?($n<20?($n<13?($d[$n].(($n-7)?(($n-1||$a)&&$n-6?'':'s'):'en')):$d[$t].'zehn'):n($t,1).($t?'und':'').$e[$n/10].(ceil($n/10)-4?'zig':'')):n((int)($n/100),1).'hundert'.n($n%100)):n((int)($n/1000),1).'tausend'.n($n%1000);}while($i<10000)echo n(++$i),"\n";
# verbose (some slight changes for readability)
function n($n, $prefix=0)
{
@idnovic
idnovic / seedutil.md
Created January 25, 2023 14:34 — forked from pookjw/seedutil.md
Enroll macOS Beta Seed without profile installation

seedutil

Enroll macOS Beta Seed without profile installation

Usage

$ sudo /System/Library/PrivateFrameworks/Seeding.framework/Versions/A/Resources/seedutil 
usage: seedutil enroll SEED_PROGRAM
    seedutil unenroll

seedutil current

@idnovic
idnovic / shellfishwidget.sh
Last active July 16, 2023 23:03
shellfish widget
#!/bin/bash
source .bashrc
loadavg=$(cat /proc/loadavg | awk '{print $2}' | sed 's/[^0-9]*//g')
cpucount=$(sed -n '/ cores/ s/[^0-9]//gp' /proc/cpuinfo | sed '1,1d')
cpu=$(($loadavg/$cpucount))
memtotal=$(sed -n '/^MemTotal:/ s/[^0-9]//gp' /proc/meminfo)
memavail=$(sed -n '/^MemAvailable:/ s/[^0-9]//gp' /proc/meminfo)
mem=$(((($memtotal-$memavail))/($memtotal/100)))
@idnovic
idnovic / pushoverssh.txt
Created February 16, 2019 23:07
pushover ssh
API_TOKEN=abcdefg1234hijklmno567890pqrstuv
API_USER=vutsrqp098765onmlkjih4321gfedcba
if [ -n "$SSH_CLIENT" ]; then
USER_IP=`echo $SSH_CLIENT|awk '{print $1}'`
TITLE="SSH: ${USER}@$(hostname -f) (${USER_IP})"
TEXT="$(date)"
curl -s \
-F "token=$API_TOKEN" \
-F "user=$API_USER" \
-F "title=$TITLE" \
@idnovic
idnovic / usefullcommands.txt
Last active December 25, 2018 20:28
Usefull commands
#clear bash history including entries in memory
cat /dev/null > ~/.bash_history && history -c && exit
history -c && history -w
# rpm show space used by packages
rpm -qa --queryformat '%10{size} - %-25{name} \t %{version}\n' | sort -n