Skip to content

Instantly share code, notes, and snippets.

View afriza's full-sized avatar

Afriza N. Arief afriza

  • Indonesia
  • 18:59 (UTC +07:00)
View GitHub Profile
@afriza
afriza / sc_mon.sh
Created April 2, 2014 02:21
Shoutcast Scripts to during start up and to keep it running
#!/bin/sh
#!/usr/bin/perl
### Shoutcast (SC_SERV)
# Taken from: http://forums.winamp.com/showthread.php?postid=2487604
## SC_SERV Server 1
if ( ! ps auxwww | grep "/home/user/sc_serv/sc_serv /home/user/sc_serv/sc_serv.conf" | grep -v grep )
then echo "Shoutcast not running..."
@afriza
afriza / admin.sql
Last active April 28, 2021 07:41 — forked from Hikingyo/admin.sql
create admin user with all privileges on mysql/mariadb
CREATE USER 'admin'@'localhost' IDENTIFIED BY 'some_pass';
GRANT ALL PRIVILEGES ON *.* TO 'admin'@'localhost' WITH GRANT OPTION;
FLUSH PRIVILEGES;
## remote connection - not secure
CREATE USER 'admin'@'%' IDENTIFIED BY 'some_pass';
GRANT ALL PRIVILEGES ON *.* TO 'admin'@'%' WITH GRANT OPTION;
FLUSH PRIVILEGES;
# Optional for MySQL 8.0
CREATE USER 'admin'@'localhost' IDENTIFIED WITH mysql_native_password BY 'some_pass';
@afriza
afriza / duration-all.sh
Created April 10, 2022 11:51
Get video duration using ffprobe from ffmpeg suite
#! /bin/sh
DIR=${1:-"."}
find "$DIR" -type f -iname "*.mp4" -print0 | sort -z | xargs -r0 -I{} duration.sh "{}"
@afriza
afriza / ssh-config
Created May 27, 2022 12:56
SSH client config to ignore/disable `StrictHostKeyChecking`
Host localhost 192.168.* 10.*
StrictHostKeyChecking no
UserKnownHostsFile=/dev/null
@afriza
afriza / restore-deleted-git-tag.md
Created June 1, 2022 07:55
Restore deleted git tag

Find unreachable tags

git fsck --unreachable | grep tag

Check tag details with

git show KEY
@afriza
afriza / docker-ips-all.sh
Last active June 10, 2022 01:21
List all IPs of all running docker containers
#! /usr/bin/env -S sh
# Reference: https://stackoverflow.com/a/36883565/109747
docker inspect --format='{{.Name}} - {{range .NetworkSettings.Networks}}{{.IPAddress}} {{end}}' $(docker ps -aq)
@afriza
afriza / ap-wlan0.network
Last active August 29, 2022 09:30
Access Point using `hostapd`, `systemd-networkd`, `dnsmasq` adapted from https://raspberrypi.stackexchange.com/q/89803/90456
# /etc/systemd/network/ap-wlan0.network
[Match]
Name=wl*
[Network]
LLMNR=no
MulticastDNS=yes
IPMasquerade=ipv4
Address=192.168.90.1/24
DHCPServer=yes
@afriza
afriza / say-macOS.sh
Last active August 30, 2022 10:54
wsay wrapper for MSYS2 (e.g. Git Bash from Git for Windows)
#!/bin/sh
# use Indonesian voice
v=$(say -v \? | grep id_ID | head -n1 | cut -d " " -f1)
say -v "$v" "$@"
@afriza
afriza / ppp-profile-on-down.rsc
Last active November 16, 2022 05:12
Automatically add & remove PPP Profile connections to & from Mikrotik IGMP Proxy Multicast Routing
# The actual on-down script. local variable matching against comment is required as of RouterOS v6.49.7
/log info "igmp-proxy interface removing $interface"
:local komen $interface
/routing igmp-proxy interface remove [/routing igmp-proxy interface find comment=$komen]
@afriza
afriza / gsed-rm-color.sh
Last active November 23, 2022 03:09
GNU sed to remove color
#!/bin/sh
sed=sed
if [ `uname` == "Darwin" ]; then
sed=`command -v gsed`
ret=$?
if [ "$ret" -ne 0 ]; then
echo 'GNU sed needs to be installed. Install with: brew install gnu-sed'
exit $ret
fi
fi