Skip to content

Instantly share code, notes, and snippets.

View hsupu's full-sized avatar
🌏
Inside

Hsu Pu hsupu

🌏
Inside
View GitHub Profile
@hsupu
hsupu / pgcli.ps1
Created July 16, 2024 09:51
Postgres Initializer
<#
.LINK
https://www.postgresql.org/docs/current/app-pg-ctl.html
#>
param(
[string]$DataDir,
[switch]$InitDataDir,
[string]$ServiceName,
[switch]$Register,
@hsupu
hsupu / cl.ps1
Last active September 1, 2022 14:54
Call cl.exe in ad-hoc way
# param (
# [Parameter(ValueFromRemainingArguments)]
# [AllowEmptyCollection()]
# [string[]]$Params
# )
param()
$ErrorActionPreference = 'Stop'
trap { throw $Error[0]; }
@hsupu
hsupu / chown.ps1
Created July 1, 2022 11:19
I'm angry!
param(
[string]$RootDir,
[switch]$DryRun
)
# $currentUser = [System.Security.Principal.WindowsIdentity]::GetCurrent()
# $currentUserName = $currentUser.Name
# $currentUserSID = $currentUser.User.Value
@hsupu
hsupu / zip-pnpm.ps1
Created February 9, 2022 02:08
Zip nodejs (pnpm) project for AWS Lambda
#!/usr/bin/env pwsh
param()
$ErrorActionPreference = 'Stop'
# base on project root
$includes = @(
'index.js',
'package.json'
)
@hsupu
hsupu / tsocks.conf
Created January 12, 2022 16:10
tsocks config in wsl
# This is the configuration for libtsocks (transparent socks)
# Lines beginning with # and blank lines are ignored
#
# The basic idea is to specify:
# - Local subnets - Networks that can be accessed directly without
# assistance from a socks server
# - Paths - Paths are basically lists of networks and a socks server
# which can be used to reach these networks
# - Default server - A socks server which should be used to access
# networks for which no path is available
# 220307 for 15.0.1
#
[buildPlans.iosevka-pu]
family = "Iosevka PU-5"
spacing = "term"
serifs = "sans"
no-cv-ss = true
no-ligation = true
[buildPlans.iosevka-pu.variants.design]
@hsupu
hsupu / windows-terminal-settings.json
Last active March 28, 2022 09:09
Windows Terminal settings.json
// sync at 220328
//
// Tips
// Go "Command Palette" via "Ctrl+Shift+P" or see https://aka.ms/terminal-documentation
// Hold "Alt" and click "Settings" to open defaults.json
// Want to send ANSI Escape Sequences?
// CSI https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797
// SS3 https://invisible-island.net/xterm/ctlseqs/ctlseqs.html
//
{
; ml64 /c a.S
; dumpbin /all a.obj > a.obj.txt
text segment PARA 'DATA'
a label PTR
; extern magic : DWORD
magic = 12345678h
; extern len : ABS
len = a_end - a
@hsupu
hsupu / ssh.config
Created February 12, 2021 13:02
OpenSSH Client Config
TCPKeepAlive yes
ServerAliveInterval 30
Include config.d/*.conf
Host 10.*.*.* 172.[16-31].*.* 192.168.*.*
StrictHostKeyChecking no
UserKnownHostsFile /dev/null
ControlMaster auto
ControlPath ~/.ssh/sessions/master-%r@%h:%p
@hsupu
hsupu / privoxy-config.txt
Last active February 17, 2022 01:34
Privoxy config.txt
# sync at 220217
listen-address 127.0.0.1:50001
forward-socks5 / 127.0.0.1:50000 .
confdir .
#actionsfile my-block.action
#actionsfile my-direct.action