Skip to content

Instantly share code, notes, and snippets.

View sxlderek's full-sized avatar

Derek Chan sxlderek

View GitHub Profile
@sxlderek
sxlderek / test-root-sendmail.sh
Created July 17, 2025 05:56
send test emails to root, to make sure they forwarded to correct destination
t="root@$(hostname -f)"; s="sendmail ${t}\n"; echo -e "Subject:${s}" | sendmail -v $t
t="root"; s="sendmail ${t}\n"; echo -e "Subject:${s}" | sendmail -v $t
t="postmaster@$(hostname -f)"; s="sendmail ${t}\n"; echo -e "Subject:${s}" | sendmail -v $t
t="nonexists@$(hostname -f)"; s="sendmail ${t}\n"; echo -e "Subject:${s}" | sendmail -v $t
t="root"; echo "test $(date)" | mail -s "mail ${t}" ${t}
t="root@$(hostname -f)"; echo "test $(date)" | mail -s "mail ${t}" ${t}
tail -n +30 -f /var/log/mail.log
@sxlderek
sxlderek / msys2-context-menu.md
Created February 19, 2022 18:58
create / delete context menu for msys2 mingw64

to create the context menu

# run in admin powershell
'Directory',
'Directory\Background',
'Drive' | ForEach-Object {
  $Path = "Registry::HKEY_CLASSES_ROOT\$_\shell\mingw64";
  New-Item -Path $Path -Name 'command' -Force | Out-Null;
 Set-ItemProperty -Path "$Path\command" -Name '(default)' -Value 'C:\\msys64\\msys2_shell.cmd -mingw64 -where "%V/"';
@sxlderek
sxlderek / shortcut-to-wt.ps1
Created February 18, 2022 18:46
create desktop shortcut to microsoft windows terminal
# download the ico
$myurl="https://raw.githubusercontent.com/microsoft/terminal/master/res/terminal.ico"
iwr -OutFile "$env:LOCALAPPDATA\\wt.ico" -uri $myurl
 
# create shortcut
$WshShell = New-Object -comObject WScript.Shell
$Shortcut = $WshShell.CreateShortcut("$env:USERPROFILE\Desktop\Windows Terminal.lnk")
$Shortcut.TargetPath = "$env:LOCALAPPDATA\Microsoft\WindowsApps\wt.exe"
$ShortCut.IconLocation = "$env:LOCALAPPDATA\\wt.ico";
$Shortcut.Save()
start %USERPROFILE%\scoop\apps\advancedrenamer\current\ARen.exe -p "%CD%"
@sxlderek
sxlderek / arenlicini.txt
Created May 4, 2019 01:31
aren setting
[fq2NGtpwzL]
rBHA60UUrR=TWUgYW5kIG15MXhoWmprYUJIZiBkb2c1OFh5emNXTVR3
GC8eTDN50Y=WFJFbmVWZk9xZTVBb3EwUTVjdmk=
KeczlieGjc=MmlNM00yZkZvYg==
xpZs2Y7ZTI=TDJ4bXNsRGw2cUVCN1czbnhIVTFVc09MQ3ptRlNjb21tZXJjaWFsVjc3WFVnaXpRcHQ=
bp0KIzZ0cq=MkVDOUYwOEZEMDY3QjI4NEFDREEyNUY1NzUxQzQ1NzU=
@sxlderek
sxlderek / ts-to-mp4.py
Last active April 24, 2017 14:28 — forked from nhtera/ts-to-mp4.py
Convert all videos .ts to .mp4 using ffmpeg
#!/usr/bin/python2.7
# Required ffmpeg
import os
import sys
walk_dir = os.getcwd()
count = 0
for root, subdirs, files in os.walk(walk_dir):
for file in files:
# search ubuntu preseed for more info
#### Contents of the preconfiguration file (for &releasename;)
### Localization
d-i debian-installer/locale string en_US.UTF-8
d-i debian-installer/language string en
d-i debian-installer/country string HK
# Keyboard selection
d-i console-setup/ask_detect boolean false
d-i console-setup/layoutcode string us
@sxlderek
sxlderek / .bash_profile
Last active December 31, 2016 17:55 — forked from natelandau/.bash_profile
Mac OSX Bash Profile
export PATH="~/bin:/usr/local/bin/":$PATH
export EDITOR=/usr/bin/vim
export BLOCKSIZE=1k
export CLICOLOR=1
export LSCOLORS=ExFxBxDxCxegedabagacad
alias ll='ls -FGlAhpk' # Preferred 'ls' implementation
alias whatismyip='curl ip.appspot.com && ' # myip: Public facing IP Address
alias flushdns='dscacheutil -flushcache' # flushDNS: Flush out the DNS Cache