Skip to content

Instantly share code, notes, and snippets.

View hongymagic's full-sized avatar
🤪

David Hong hongymagic

🤪
View GitHub Profile
@hongymagic
hongymagic / Setup-WSL-Port-Forwarding.ps1
Created June 17, 2022 04:49
Windows 11 Forward ports to WSL 2 instance
<#
.Description
Setup-WSL-Port-Forwarding function forwards commonly used ports from host to WSL.
The forwarded ports include standard HTTP, HTTPS, Postgres, Redis and other development ports.
Run:
Setup-WSL-Port-Forwarding.ps1
#>
$PortsToForward = @(80, 443, 1025, 3000, 3001, 4444, 5000, 5900, 8025, 8080, 8081, 8888, 8900, 9090, 9091, 9190, 9191, 5432, 6379)
@hongymagic
hongymagic / Interval.cs
Last active December 15, 2023 13:09
Representing Intervals in C# with Generics support `Interval<T>`
using System;
namespace Hongy
{
/// <summary>
/// Represents vectorless interval of the form [a, b] or (a, b) or any
/// combination of exclusive and inclusive end points.
/// </summary>
/// <typeparam name="T">Any comparent type</typeparam>
/// <remarks>
@hongymagic
hongymagic / README.md
Created March 12, 2012 23:57
Simple zsh wrapper to launch iA Writer from the terminal

This is a simple script to launch iA Writer from the terminal. It is extremely useful for interacting with Github's own wiki system as it provides git access.

INSTALL

One-liner

curl -L https://raw.github.com/gist/2025540/4f3f094286468db2588f40345e6faaf07bd5af2a/ia > /usr/local/bin/ia && chmod u+x /usr/local/bin/ia

Manual, safer way

version: "3.4"
services:
neko:
image: "m1k1o/neko:google-chrome"
restart: "unless-stopped"
shm_size: "2gb"
ports:
- "80:8080"
- "52000-52100:52000-52100/udp"
cap_add:
@hongymagic
hongymagic / css.parser.js
Created August 2, 2011 04:02
A Simple CSS Properties parser
///
/// CSS Parser method
///
/// @param css-properties {String} Semi-colon delimitered CSS properties
/// @returns {Object} JSON-style name/value pair
///
/// @usage:
/// parse('font-weight: 700; font-size: 1em', 'font-family: Verdana, sans-serif');
///
/// This is a pretty inefficient way of parsing CSS properties. The purpose here
@hongymagic
hongymagic / README.md
Last active May 20, 2022 01:25
Setup port forwarding from host to WSL 2

How to use it

  1. Download the above script
  2. Place it somewhere in your drive
  3. The run it
Setup-WSL-Port-Forwarding.ps1
@hongymagic
hongymagic / store.json
Created April 11, 2012 07:59
hon.gy URLs
{
"GzUiYC": "http://greenbytes.de/tech/tc/httplink/",
"OYhntj": "http://documentcloud.github.com/backbone/#Model-save",
"aMJFI5": "http://twitter.com/hongymagic",
"4irhw5": "http://iphone.news.com.au/",
"kony2012": "http://kony2012.com/",
"s8Ad9c": "https://gist.github.com/1532562",
"0d9oZX": "http://www.codinghorror.com/blog/2007/02/why-cant-programmers-program.html#comments",
"KTGqtO": "http://hyperpolyglot.org/scripting",
"tqG8pm": "http://jsbin.com/itiqop/3/edit#javascript,live",
sudo codesign --remove-signature "/Applications/Microsoft Teams.app"
sudo codesign --remove-signature "/Applications/Microsoft Teams.app/Contents/Frameworks/Microsoft Teams Helper.app"
sudo codesign --remove-signature "/Applications/Microsoft Teams.app/Contents/Frameworks/Microsoft Teams Helper (GPU).app"
sudo codesign --remove-signature "/Applications/Microsoft Teams.app/Contents/Frameworks/Microsoft Teams Helper (Plugin).app"
sudo codesign --remove-signature "/Applications/Microsoft Teams.app/Contents/Frameworks/Microsoft Teams Helper (Renderer).app"
@hongymagic
hongymagic / remap.ahk
Created February 17, 2019 22:32
Windows 10 key remap
; Natural scrolling of the mouse wheels
WheelUp::WheelDown
WheelDown::WheelUp
; Remap Caps Lock to something more useful
CapsLock::Escape