Skip to content

Instantly share code, notes, and snippets.

View alanhg's full-sized avatar
⌨️
Focusing

Alan.He alanhg

⌨️
Focusing
View GitHub Profile
@kevincennis
kevincennis / v8.md
Last active March 2, 2024 21:50
V8 Installation and d8 shell usage

Installing V8 on a Mac

Prerequisites

  • Install Xcode (Avaliable on the Mac App Store)
  • Install Xcode Command Line Tools (Preferences > Downloads)
  • Install depot_tools
    • $ git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
    • $ nano ~/.zshrc
    • Add path=('/path/to/depot_tools' $path)
@vookimedlo
vookimedlo / macos_mute_unmute.md
Last active February 23, 2024 12:17
MacOS: mute & unmute from command line

Mute volume

osascript -e "set volume with output muted"

Unmute volume

osascript -e "set volume without output muted"
@kolodny
kolodny / proxy.js
Created January 4, 2016 02:23 — forked from cmawhorter/proxy.js
Node script to forward all http requests to another server and return the response with an access-control-allow-origin header. Follows redirects.
// Simple proxy/forwarding server for when you don't want to have to add CORS during development.
// Usage: node proxy.js
// Open browser and navigate to http://localhost:9100/[url]
// Example: http://localhost:9100/http://www.google.com
// This is *NOT* for anything outside local development. It has zero error handling among other glaring problems.
// This started as code I grabbed from this SO question: http://stackoverflow.com/a/13472952/670023
@jehiah
jehiah / simple_args_parsing.sh
Created March 4, 2011 16:56
a simple way to parse shell script arguments
#!/bin/sh
#
# a simple way to parse shell script arguments
#
# please edit and use to your hearts content
#
ENVIRONMENT="dev"
@rambolee
rambolee / update-dnsmasq-from-gfwlist.py
Last active September 22, 2023 09:48
升级 小米路由器3 可以ssh 可以 Shadowsocks [Tags]: 小米路由, 小米路由3, 小米路由器, 小米路由器3, ssh, shadowsocks
#!/usr/bin/env python
#coding=utf-8
#
# Generate a list of dnsmasq rules with ipset for gfwlist
#
# Copyright (C) 2014 http://www.shuyz.com
# Ref https://code.google.com/p/autoproxy-gfwlist/wiki/Rules
import urllib2
import re
@p120ph37
p120ph37 / dualfactor_anyconnect.md
Last active September 29, 2022 03:39
How to connect to a Cisco AnyConnect VPN server from the OSX (or Linux) command-line without using the AnyConnect client. Specifically, one which uses VeriSign/Symantec VIP Access dual-factor tokens.

(For Linux users, make sure you have oathtool and openconnect, then start from Step 6. If you don't have a token secret key, have a friend generate one for you on OSX via steps 3-5)

Step 1

Get homebrew and install oath-toolkit, openconnect, and tuntap.
And follow the additional tuntap installation instructions!

Step 2

After the tuntap module is installed, reboot or use kextload to activate it.

@clarkb7
clarkb7 / unicode.md
Last active August 29, 2022 19:43
A guide to character encoding aware development
@parisk
parisk / default.js
Last active July 18, 2022 14:24
xterm.js keyMap
/**
* Example keymap for usage in xterm.js
* Original issue: https://github.com/sourcelair/xterm.js/issues/487
*/
// We export this as default, since the only thing we care about
// is the contents of the keymap. No classes, methods or anything
// else is expected.
export default let keyMap =
@alanhg
alanhg / install-package-lrzsz.sh
Last active July 16, 2022 08:41
install-package-lrzsz.sh / shell
#!/bin/sh
# sudo sh -c "$(curl -fsSL https://gist.githubusercontent.com/alanhg/6a299b815f4dd3d242abc16b8be6b861/raw/dbe1497208f1d968ed8b67cad09c596e35c5be9c/install-package-lrzsz.sh)"
YUM_CMD=$(which yum)
APT_GET_CMD=$(which apt-get)
APT_CMD=$(which apt)
PACKAGE=lrzsz
if [ ! -z $YUM_CMD ]; then
yum install -y $PACKAGE
@condran
condran / FeignClientWithPATCH.md
Last active May 30, 2022 19:18
Spring Cloud Netflix with PATCH (client side)

Spring Cloud Netflix with PATCH (client side)

I have been researching Spring Boot and Spring Cloud, there are lots of goodies here but as with all technology there are gotchas.

Feign Client does not support PATCH out of the box! ಠ_ಠ ... ಠ~ಠ ... ⊙︿⊙

You might see an error like this if you try to use RequestMethod.PATCH in your @FeignClient interface: java.net.ProtocolException: Invalid HTTP method: PATCH

I am using the current versions: