Skip to content

Instantly share code, notes, and snippets.

@for2ando
for2ando / !open-browsers.sh
Last active October 26, 2026 11:46
Open all the browsers I use, in the order I want on windows.
open-browsers.sh
wsl-complete-command-extension.sh
@for2ando
for2ando / resolv.awk
Created January 18, 2024 14:22
Update /etc/resolv.conf from a ipconfig /all output, for Windows w/ Cygwin. Retreive from https://cygwin.com/pipermail/cygwin/2018-June/237655.html.
#!/usr/bin/awk -f
# resolv.awk - create Windows resolv.conf from ipconfig /all output
{ sub( /\r/, "", $NF) } # trim \r
# collect DNS domain suffixes
/D[Nn][Ss]\sSuffix[^:]*:\s\S/ { domain[$NF] = $NF }
# collect DNS search suffixes
/Search\sList[^:]*:\s\S/ { search[$NF] = $NF }
@for2ando
for2ando / !path.sh
Last active October 21, 2026 14:34
PATH manipulation functions' library
path.sh
@for2ando
for2ando / wikifilename.sh
Created May 3, 2023 13:46
Return a encoded string for a filename for pukiwiki.
#!usr/bin/env bash
echo $(echo -n FrontPage|od -A x -t x1|sed "s/^......//;s/ //g"|tr "a-z" "A-Z").txt
@for2ando
for2ando / pyhttpd-start
Created March 8, 2023 10:45
Python3 http.server start/stop script
#!/usr/bin/env bash
pname="$(basename $0)"
htdocs=/var/www/htdocs
logfile=/var/log/pyhttpd/httpd.log
pidfile=/var/run/pyhttpd.pid
port=8086
httpd="python3 -m http.server --cgi $port"
proc_signature="[0-9]:[0-9][0-9] $httpd"
@for2ando
for2ando / readlink-recursive
Created December 7, 2022 16:26
A recursive version of readlink command.
@for2ando
for2ando / msys2_select.cmd
Created July 5, 2022 15:18
Msys2: A MSYSTEM selection & go script.
@echo off
:input
echo 1. msys2
echo 2. mingw32
echo 3. mingw64
echo 4. clang64
echo 5. ucrt64
echo 0. quit
set /p menu="Which ? "
if %menu%/ == / goto input
@for2ando
for2ando / ghcup
Created July 3, 2022 13:26
Ghcup setup script. I put it on ~/.bashrc.d/ghcup.
#!/bin/sh
if grep -q '^NAME=.*openSUSE' /etc/os-release; then
source "$HOME/.ghcup/env"
elif grep -q '^NAME=.*MSYS2' /etc/os-release; then
source "$(cygpath -u ${GHCUP_INSTALL_BASE_PREFIX}\\ghcup\\env)"
fi
@echo off
echo TeraTerm Serial Port
set /p comport="Port: COM"
start "" "%TTBIN%\ttermpro.exe" /F="%TTETC%\teraterm.ini" /C=%comport% /W=com%comport%
rem pause