Skip to content

Instantly share code, notes, and snippets.

View akunzai's full-sized avatar

Charley Wu akunzai

  • Taipei,Taiwan
  • 13:16 (UTC +08:00)
  • X @akunzai
View GitHub Profile
@nonkronk
nonkronk / vscode-tunnel-daemon-oracle-cloud.md
Last active June 28, 2024 09:42
Setup an Always-on VSCode Tunnel on Ubuntu Server

Setup an Always-on VSCode Tunnel on Oracle Cloud Always-free Instance

Access Oracle Cloud VM from any browser on any devices

Install VSCode for arm64

wget -O vscode.deb https://code.visualstudio.com/sha/download\?build\=stable\&os\=linux-deb-arm64 && sudo apt install ./vscode.deb --fix-broken -y && rm vscode.deb
@ingramchen
ingramchen / sealed_example.kt
Last active February 23, 2023 03:36
Domain Model Layer Convention (Model 層級管理)

Model 層級管理

Domain Model 層的意義

一個傳統 Java Spring 的應用程式會分為三層 @Controller @Service @Repository,然後依據組織需求,再往下細分。 比方說 Service 層複雜的話,會增加 Gateway、Facade 層,或是我們組織獨有的 CoreService 層

另一個層級大部份 Java 組織會忽略的是 Domain Model 層,絕大多數 Java 開發者會開個 entity 或 model package,然後 將所有的 Entity 往裡面丟。然而該 Entity 只是一堆欄位和 getter/setter 的堆疊,也就是單純的 Table 的對應物件而已, 不具備任何 business logic

@NickCraver
NickCraver / Microsoft.PowerShell_profile.ps1
Last active March 18, 2024 13:25
Craver's oh-my-posh profile
# This goes in your Microsoft.PowerShell_profile.ps1 (can find the path via $PROFILE in your prompt)
Import-Module -Name posh-git,oh-my-posh,Terminal-Icons
Set-PoshPrompt -Theme craver
@pmbaumgartner
pmbaumgartner / cloud-init.yaml
Last active May 8, 2024 15:01
Multipass & Docker Setup
#cloud-config
package_upgrade: true
ssh_authorized_keys:
- <your key>
packages:
- apt-transport-https
- ca-certificates
- curl
@janzikmund
janzikmund / Postman-pre-request-script-csrf-token-laravel-sanctum.js
Last active May 31, 2024 02:16
Postman Pre-Request script to append CSRF token in header for POST requests in Laravel Sanctum authenticated SPA. Requires active environment with {{url}} variable defined for main app domain.
/**
* Postman Pre-Request script to append CSRF token in header for POST requests in Laravel
* Sanctum authenticated SPA. Requires active environment with {{url}} variable defined
* for main app domain.
*
* Postman Interceptor allows appending cookies from browser, but Laravel CSRF middleware
* only validates CSRF in headers or in _token form field, not in cookies. Axios automatically
* appends the CSRF from cookie to headers, but Postman cannot access intercepted cookies
* and use them, so we have to do one pre-request to get the CSRF token, store it
* in environment so it can be reused, and then append it to headers.
@akunzai
akunzai / .zshenv
Last active July 5, 2024 02:05
My ZSH profile
# https://www.cyberciti.biz/faq/apple-mac-osx-terminal-color-ls-output-option/
export CLICOLOR=1
export EDITOR=vi
# https://learn.microsoft.com/dotnet/core/tools/dotnet-environment-variables#dotnet_cli_ui_language
export DOTNET_CLI_UI_LANGUAGE='en-us'
# https://learn.microsoft.com/aspnet/core/fundamentals/environments
export DOTNET_ENVIRONMENT=Development
export ASPNETCORE_ENVIRONMENT=Development
@3v1n0
3v1n0 / vscode-unused-workspace-storage-cleanup.sh
Last active May 22, 2024 18:13
VSCode unused workspaceStorage cleanup
#!/bin/bash
CONFIG_PATH=~/.config/Code
for i in $CONFIG_PATH/User/workspaceStorage/*; do
if [ -f $i/workspace.json ]; then
folder="$(python3 -c "import sys, json; print(json.load(open(sys.argv[1], 'r'))['folder'])" $i/workspace.json 2>/dev/null | sed 's#^file://##;s/+/ /g;s/%\(..\)/\\x\1/g;')"
if [ -n "$folder" ] && [ ! -d "$folder" ]; then
echo "Removing workspace $(basename $i) for deleted folder $folder of size $(du -sh $i|cut -f1)"
@belaw
belaw / fork.reg
Last active May 21, 2024 05:21
Fork Git Client Windows Explorer Integration
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\directory\background\shell\git_fork]
@="Open in &Fork"
"Icon"=hex(2):25,00,4c,00,4f,00,43,00,41,00,4c,00,41,00,50,00,50,00,44,00,41,\
00,54,00,41,00,25,00,5c,00,46,00,6f,00,72,00,6b,00,5c,00,46,00,6f,00,72,00,\
6b,00,2e,00,65,00,78,00,65,00,2c,00,30,00,00,00
[HKEY_CLASSES_ROOT\directory\background\shell\git_fork\command]
@=hex(2):22,00,25,00,4c,00,4f,00,43,00,41,00,4c,00,41,00,50,00,50,00,44,00,41,\
@kevin-montrose
kevin-montrose / SecurityCodeScan.config.yml
Created September 23, 2019 20:59
Example SecurityCodeScan configuration file from Stack Overflow codebase
# This is based on https://github.com/security-code-scan/security-code-scan/blob/master/SecurityCodeScan/Config/Main.yml
# IMPORTANT: YML is very strict about indentation and white spaces
Version: 2.1
# Set to 'true' to see more warnings
AuditMode: false
# Allows to define custom anti CSRF attributes and conditions
@akunzai
akunzai / settings.json
Last active May 19, 2024 09:49
My Windows Terminal settings
{
"$help": "https://aka.ms/terminal-documentation",
"$schema": "https://aka.ms/terminal-profiles-schema",
"actions":
[
{
"command":
{
"action": "splitPane",
"split": "auto",