This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Crop a part of a video with FFMPEG | |
if [[ $# -eq 0 ]] ; then | |
echo "Usage:" | |
echo " $0 <filename> <left> <right> <top> <bottom>" | |
echo "" | |
echo "Example:" | |
echo " $0 myvid.mp4 700 600 200 400" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var nativeEndian binary.ByteOrder | |
func init() { | |
buf := [2]byte{} | |
*(*uint16)(unsafe.Pointer(&buf[0])) = uint16(0xABCD) | |
switch buf { | |
case [2]byte{0xCD, 0xAB}: | |
nativeEndian = binary.LittleEndian | |
case [2]byte{0xAB, 0xCD}: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Get vendors from /proc/net/arp with systemd's OUI vendor database | |
set -eu | |
set -o pipefail | |
OUIDB=/usr/lib/udev/hwdb.d/20-OUI.hwdb | |
while IFS=$' ' read -r ipaddr htype flags mac mask iface; | |
do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
# Output JSON from ImageMagick magick identify command | |
if [[ $# -eq 0 ]] ; then | |
echo "Usage:" | |
echo " $0 <filename>" | |
echo "" | |
exit 0 | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
find . -maxdepth 1 -type f -iname "*.pdf" -exec gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dDownsampleColorImages=true -dColorImageResolution=150 -dNOPAUSE -dBATCH -sOutputFile={}.new.pdf {} \; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -eu | |
set -o pipefail | |
DEST=127.0.0.1 | |
# this adjusts the latency in the receiver | |
LATENCY=0 | |
VIDEO_CAPS="application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)H264" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Usage: | |
$ php dump.php "SELECT * FROM mytable" > mytable.json | |
*/ | |
error_reporting(E_ALL | E_STRICT); | |
ini_set('display_startup_errors', 1); | |
ini_set('display_errors', 1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# systemctl --user enable murmur | |
# systemctl --user start murmur | |
# .config/systemd/user/murmur.service : | |
[Unit] | |
Description=Mumble Daemon | |
After=network.target | |
[Service] | |
Type=simple | |
ExecStart=/usr/bin/murmurd -ini murmur.ini -fg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# IP address range to CIDR | |
import sys | |
import ipaddress | |
if (len(sys.argv) - 1) != 2: | |
print("Usage: ") | |
print(f" {sys.argv[0]} <ip address> <ip address>") | |
print("Example: ") | |
print(f" {sys.argv[0]} 192.168.0.0 192.168.0.255") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Fetch system specific information | |
# -- Get Operating system name such as "Win 10 Pro" | |
$replaceTable = @{ | |
"Microsoft" = "" | |
"Windows" = "Win" | |
"Professional" = "Pro" | |
"Ultimate" = "Ult" | |
"Enterprise" = "Ent" | |
"Edition" = "Ed" |