Skip to content

Instantly share code, notes, and snippets.

setTimeout(function(){debugger;}, 5000)
nvm install lts/* --reinstall-packages-from=node
@kampfgnu
kampfgnu / gist:06d978e18abcf4dedda7a80bdcae9144
Created December 8, 2020 11:32
display markdown from terminal
grip -b filename.md
@kampfgnu
kampfgnu / gist:8b75aadc449938588741827921627925
Created December 8, 2020 11:20
dump tables of a db to single files with hardcoded password
#!/bin/bash
# dump-tables-mysql.sh
# Descr: Dump MySQL table data into separate SQL files for a specified database.
# Usage: Run without args for usage info.
# Author: @Trutane
# Ref: http://stackoverflow.com/q/3669121/138325
# Notes:
# * Script will prompt for password for db access.
# * Output files are compressed and saved in the current working dir, unless DIR is
@kampfgnu
kampfgnu / gist:5670865cb7fc94c4f803f06c27ba0cfe
Last active December 8, 2020 11:22
disk usage recursive list size sorted size ASC (the "/" after "*" is used to list folders only)
du -sh */ | sort -hr
import os, time
from stat import * # ST_SIZE etc
from os import walk
import datetime
extensions = [".jpeg", ".jpg", ".png", ".mov", ".aae", ".mp4"]
files = []
for (dirpath, dirnames, filenames) in walk("./"):
files.extend(filenames)
# cd $1
for file in *.{JPG,jpg,JPEG,jpeg}
do date=$(stat -f %B $file)
dateFormatted=$(date -r $date +%Y-%m-%d' '%H.%M.%S)
mv $file "$dateFormatted.jpg"
done
for file in *.{PNG,png}
do date=$(stat -f %B $file)
http://loopstream01.apa.at/?channel=oe1&shoutcast=0&ua=flash&id=[loopStreamId]
e.g.
http://loopstream01.apa.at/?channel=oe1&shoutcast=0&ua=flash&id=2019-09-08_1405_tl_51_7DaysSun21_1069721.mp3
@kampfgnu
kampfgnu / mygamepad.py
Created February 15, 2019 15:52
listen for gamepad events and do some stuff for my home audio setup
#!/usr/bin/python
# --------------------------------------------------------------------------
#
# --------------------------------------------------------------------------
#import evdev
from evdev import InputDevice, categorize, ecodes
from subprocess import call
#creates object 'gamepad' to store the data
@kampfgnu
kampfgnu / gist:12043ae747e06c9dc55c05aa5d49dcc2
Created November 26, 2018 17:21
list size of subfolders larger or equal 1 GB
du -h -d 1 | grep '[0-9]G\>'