Skip to content

Instantly share code, notes, and snippets.

View watain666's full-sized avatar
🔥
I may be slow to respond.

TiâuUî Lâu watain666

🔥
I may be slow to respond.
View GitHub Profile
@watain666
watain666 / bootable-win-on-mac.md
Last active April 25, 2024 16:55 — forked from acarril/bootable-win-on-mac.md
Create a bootable Windows USB using macOS

For some reason, it is surprisingly hard to create a bootable Windows USB using macOS. These are my steps for doing so, which have worked for me in macOS Ventura (13.6) for Windows 10 and 11. After following these steps, you should have a bootable Windows USB drive.

1. Download a Windows disc image (i.e. ISO file)

You can download Windows 10 or Windows 11 directly from Microsoft.

2. Identify your USB drive

After plugging the drive to your machine, identify the name of the USB device using diskutil list, which should return an output like the one below. In my case, the correct disk name is disk2.

@watain666
watain666 / linux-networking-tools.md
Created February 21, 2024 09:05 — forked from miglen/linux-networking-tools.md
Linux networking tools

List of Linux networking tools

netstat (ss)

Displays contents of /proc/net files. It works with the Linux Network Subsystem, it will tell you what the status of ports are ie. open, closed, waiting, masquerade connections. It will also display various other things. It has many different options. Netstat (Network Statistic) command display connection info, routing table information etc. To displays routing table information use option as -r.

Sample output:

Proto Recv-Q Send-Q  Local Address          Foreign Address        (state)    
tcp4 0 0 127.0.0.1.62132 127.0.0.1.http ESTABLISHED
@watain666
watain666 / mac-upgrade.sh
Created May 3, 2023 19:13 — forked from arturmartins/mac-upgrade.sh
How to keep your mac software updated easily (2022)
#!/bin/bash
# Requirements:
# - homebrew: https://brew.sh/
# - homebrew tap: buo/cask-upgrade - https://github.com/buo/homebrew-cask-upgrade
# - homebrew mas (Mac App Store command-line interface - https://github.com/mas-cli/mas)
# Update, upgrade all and cleanup
brew update && brew upgrade && brew cu --all --yes --cleanup && mas upgrade && brew cleanup
# Dump all taps, apps, casks and mac apps into ~/Brewfile
@watain666
watain666 / ptt_ip.md
Created October 21, 2022 08:34 — forked from nevikw39/ptt_ip.md
ptt IP

ptt IP

Detect whether an IP address on ptt belong to VPN or proxy networks

一款 userscript, 令您只要雙擊選取 pttIP 便可即時取得相關資訊.

適用於 www.ptt.cc, term.ptt.cc.

安裝步驟

@watain666
watain666 / vscode-macos-context-menu.md
Created March 25, 2022 09:59 — forked from idleberg/vscode-macos-context-menu.md
“Open in Visual Studio Code” in macOS context-menu

Open in Visual Studio Code

  • Open Automator
  • Quick Action
  • Set “Service receives selected” to files or folders in any application
  • Add a Run Shell Script action
  • Set the script action to the following
    for f in "$@"; do
    

open -a 'Visual Studio Code' "$@"

@watain666
watain666 / tarcheatsheet.md
Created March 24, 2022 07:24 — forked from haskaalo/tarcheatsheet.md
Tar usage / Tar Cheat Sheet

Tar Usage / Cheat Sheet

Compress a file or directory

e.g: tar -czvf name-of-archive.tar.gz /path/to/directory-or-file

  • -c: Create an archive.
  • -z: Compress the archive with gzip.
  • -v: makes tar talk a lot. Verbose output shows you all the files being archived and much.
  • -f: Allows you to specify the filename of the archive.
@watain666
watain666 / orm where builder.go
Created October 18, 2021 10:53
orm where builder
package main
import (
"fmt"
"strings"
)
func main() {
fmt.Println("Hello, playground")
TestWhereBuild()
@watain666
watain666 / .Title
Created October 16, 2021 21:55 — forked from congjf/.Title
Using MongoDB in golang with mgo
Using MongoDB in golang with mgo
@watain666
watain666 / crack_right_click.min.js
Last active July 23, 2020 05:50
Crack disable select and contextmenu, just select and drag this one line js code to your bookmarks, and click it.
javascript:(()=>{(()=>{function n(n){ona='on'+n,window.addEventListener&&window.addEventListener(n,function(n){for(let o=n.originalTarget;o;o=o.parentNode)o[ona]=null},!0),window[ona]=null,document[ona]=null,document.body&&(document.body[ona]=null)}n('contextmenu'),n('click'),n('mousedown'),n('mouseup'),n('selectstart')})();})()
@watain666
watain666 / cmder_prompt.lua
Last active July 2, 2020 08:15
Add current date/time to clink/cmder prompt. Ref: https://superuser.com/a/1192357/916566
function custom_prompt()
cwd = clink.get_cwd()
prompt = "\x1b[1;32;40m{cwd} {git} {hg}\x1b[1;30;40m{time}\n{lamb} \x1b[0m"
new_value = string.gsub(prompt, "{cwd}", cwd)
add_time = string.gsub(new_value, "{time}", os.date("%x - %X"))
clink.prompt.value = string.gsub(add_time, "{lamb}", "λ")
end
clink.prompt.register_filter(custom_prompt, 1)