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
# Samba 4 config example | |
# Connected to existing remote Samba 4 Active Directory Directory Controller | |
# ZFS pool @ /storage | |
# Network is 192.168.101.0/24 | |
# Samba is installed with: | |
# pkg install samba42 | |
# and then joined to existing AD with: | |
# samba-tool domain join <params> | |
# After this /usr/local/etc/smb4.conf is edited and restarted with /usr/local/etc/rc.d/samba_server restart |
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
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 | |
# Cut a part of a video with FFMPEG | |
if [[ $# -eq 0 ]] ; then | |
echo "Usage:" | |
echo " $0 <filename> <start position timestamp> <duration> [additional params]" | |
echo "" | |
echo "Example:" | |
echo " Cut 50 seconds starting from timestamp 01:23:45 from file myvid.mp4" |
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
# mac: | |
echo "..." | perl -pe 's@[\da-f:]{17}@xx:xx:xx:xx:xx:xx@ig' | |
# IPv4 | |
echo "..." | perl -pe 's@[\d\.]{7,15}@X.X.X.X@ig' |
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
$Shell=$Host.UI.RawUI | |
$size=$Shell.WindowSize | |
$size.width=120 | |
$size.height=35 | |
$Shell.WindowSize=$size | |
# buffer | |
$size = $Shell.BufferSize | |
$size.width=[system.console]::BufferWidth |
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" |
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
$items = Get-ItemProperty -Path 'Registry::HKey_Local_Machine\Software\Microsoft\Windows NT\CurrentVersion\ProfileList\*' | |
Foreach ($item in $items) { | |
$objUser = New-Object System.Security.Principal.SecurityIdentifier($item.PSChildName) | |
$objName = $objUser.Translate([System.Security.Principal.NTAccount]) | |
$item.PSChildName = $objName.value | |
} | |
Write-Output $items | Select-Object -Property PSChildName, ProfileImagePath |