Skip to content

Instantly share code, notes, and snippets.

View akunzai's full-sized avatar

Charley Wu akunzai

  • Taipei,Taiwan
  • 16:46 (UTC +08:00)
  • X @akunzai
View GitHub Profile
@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 September 9, 2024 17:38
My Windows Terminal settings
{
"$help": "https://aka.ms/terminal-documentation",
"$schema": "https://aka.ms/terminal-profiles-schema",
"actions":
[
{
"command":
{
"action": "newTab"
},
using System;
using System.IO;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Text.Json.Serialization;
using System.Threading;
using System.Threading.Tasks;
@lizthegrey
lizthegrey / attributes.rb
Last active July 17, 2025 01:43
Hardening SSH with 2fa
default['sshd']['sshd_config']['AuthenticationMethods'] = 'publickey,keyboard-interactive:pam'
default['sshd']['sshd_config']['ChallengeResponseAuthentication'] = 'yes'
default['sshd']['sshd_config']['PasswordAuthentication'] = 'no'
@popstas
popstas / docker-logs-localtime
Last active November 14, 2024 06:03
docker-logs-localtime - Replace all UTC dates in docker logs output to local dates in pipe
#!/usr/bin/env node
// replace all UTC dates to local dates in pipe
// usage: docker logs -t container_name | docker-logs-localtime
// install:
// curl https://gist.githubusercontent.com/popstas/ffcf282492fd78389d1df2ab7f31052a/raw/505cdf97c6a1edbb10c3b2b64e1836e0627b87a0/docker-logs-localtime > /usr/local/bin/docker-logs-localtime && chmod +x /usr/local/bin/docker-logs-localtime
// alternative: https://github.com/HuangYingNing/docker-logs-localtime
const pad = d => (d > 9 ? d : '0' + d);
@natemcmaster
natemcmaster / README.md
Last active April 2, 2024 18:27
runtimeconfig.json schema

This defines the schema for .NET Core's runtimeconfig.json file.

Usage in an editor

Using Visual Studio, you can get auto-completion if you import the schema in your .JSON file like this:

{
  "$schema": "https://gist.githubusercontent.com/natemcmaster/0bdee16450f8ec1823f2c11af880ceeb/raw/runtimeconfig.template.schema.json"
}
@akunzai
akunzai / Microsoft.PowerShell_profile.ps1
Last active September 7, 2024 12:20
My PowerShell profile
# https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_profiles
# PowerShell < 6 on Windows: $Home\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
# PowerShell >= 6 on Windows: $Home\Documents\PowerShell\Microsoft.PowerShell_profile.ps1
# PowerShell on Linux/macOS: ~/.config/powershell/Microsoft.PowerShell_profile.ps1
# https://learn.microsoft.com/dotnet/core/tools/dotnet-environment-variables#dotnet_cli_ui_language
$env:DOTNET_CLI_UI_LANGUAGE = 'en-us'
# https://github.com/PowerShell/PSReadLine
if (Get-Command 'Set-PSReadlineKeyHandler' -ErrorAction SilentlyContinue) {
@doggy8088
doggy8088 / settings.json
Last active July 16, 2025 00:42
Will 保哥的 VSCode 使用者設定檔
{
"explorer.openEditors.visible": 0,
"workbench.colorTheme": "Default Light+",
"workbench.iconTheme": "vscode-simpler-icons",
"workbench.sideBar.location": "right",
// 需下載安裝 Fira Code 字型 (安裝 OTF 格式)
// https://github.com/tonsky/FiraCode/releases
// 需下載客製化過的 Microsoft YaHei Mono 字型
@joeytwiddle
joeytwiddle / async-await-forEach-alternatives.md
Last active June 30, 2025 03:36
Do not use forEach with async-await

Do not use forEach with async-await

TLDR: Use for...of instead of forEach() in asynchronous code.

For legacy browsers, use for(...;...;...) or [].reduce()

To execute the promises in parallel, use Promise.all([].map(...))

The problem

@pabloab
pabloab / landscape-sysinfo-alternative.sh
Last active October 21, 2023 18:36
[landscape-sysinfo alternative ], more cross-linux
#!/bin/bash
# Simple motd script for any systemd Linux (tested on Debian)
# Inspiration: https://superuser.com/questions/919962/landscape-sysinfo-for-centos
# Inspiration 2: https://github.com/thusoy/headsup/blob/master/headsup.py
os-name=$()
os-kernel=$()
date-today=$()
system-load=$()
processes=$(cat /proc/loadavg | cut -d"/" -f2| cut -d" " -f1)