Skip to content

Instantly share code, notes, and snippets.

View yyang's full-sized avatar

Steve Yang yyang

View GitHub Profile
@yyang
yyang / centos7.sh
Last active September 27, 2023 04:40
centos 7 pptpd firewalld
#!/bin/sh
#
# pptpd installation script on my own CentOS 7 box.
# inspired by: https://www.digitalocean.com/community/questions/how-to-install-pptp-vpn-on-centos-7
# and http://unix.stackexchange.com/questions/150837/redhat-centos-7-firewalld-best-practice-for-pptp-or-l2tp-ipsec-rules
#
# Author: 2015 Steve Yang <me@iyyang.com>
# The script comes with ABSOLUTELY NO WARRANTY.
@yyang
yyang / README.md
Last active May 2, 2020 11:09
Fix WSL Issues

Fix WSL Issues (That happens in China)

raw.githubusercontent.com not accessible:

Add the following line to /etc/hosts

199.232.28.133 raw.githubusercontent.com
@yyang
yyang / buffer.js
Created May 28, 2016 07:39
Buffer polyfill.
import semver from 'semver';
let supportedEncoding = ['ascii', 'utf8', 'utf16le', 'ucs2', 'base64',
'binary', 'hex'];
let currentVersion = semver.clean(process.version);
/**
* Polifills Object to obtain modern APIs.
* @param {String} targetVersion Target version to be polyfilled.
* @param {Object} object Object to polyfill.
@yyang
yyang / gist:8cb39f6058820eae3f863b274c7c9029
Created September 22, 2016 07:36
WeChat Payment Notes.
// when your webapp is loaded, before adding listener for weixing js bridge, check if it's already initialized:
var timeoutID = 0;
if (typeof WeixinJSBridge == "undefined") {
alert('Already in WeChat!');
} else {
// setup a time out of let's say 5 seconds, to wait for the bridge:
timeoutID = window.setTimeout(WeChatBridgeTimeout, 5000);
// now add listener for the bridge:
document.addEventListener('WeixinJSBridgeReady', WeChatBridgeReady, false);
@yyang
yyang / Preferences.sublime-settings
Last active September 18, 2016 14:14
Sublime Text Preferences
{
"always_show_minimap_viewport": true,
"auto_complete_commit_on_tab": true,
"color_scheme": "Packages/Material Theme/schemes/OLD/Material-Theme-Darker.tmTheme",
"default_line_ending": "unix",
"draw_white_space": "all",
"ensure_newline_at_eof_on_save": true,
"highlight_line": true,
"ignored_packages":["Markdown"],
"overlay_scroll_bars": "enabled",
@yyang
yyang / spoiler.sh
Created September 14, 2016 14:19
macOS Sierra spoiler for VMWare Workstation installation.
#!/bin/bash
# Mount the Installer image
hdiutil attach /Applications/Install\ macOS\ Sierra.app/Contents/SharedSupport/InstallESD.dmg -noverify -nobrowse -mountpoint /Volumes/install_app
# Create Sierra sparseimage of 7316mb with a Single Partition - Apple Partition Map
hdiutil create -o /tmp/Sierra -size 7316m -layout SPUD -fs HFS+J -type SPARSE
# Mount the Sierra sparseimage
hdiutil attach /tmp/Sierra.sparseimage -noverify -nobrowse -mountpoint /Volumes/install_build