Skip to content

Instantly share code, notes, and snippets.

Avatar
😀
Busy?

Tony Xu tonyxu-io

😀
Busy?
View GitHub Profile
@tonyxu-io
tonyxu-io / Tony Xu Terminal Profile.terminal
Created Jul 10, 2020
Tony Xu's profile for Terminal.app
View Tony Xu Terminal Profile.terminal
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>ANSIBlueColor</key>
<data>
YnBsaXN0MDDUAQIDBAUGBwpYJHZlcnNpb25ZJGFyY2hpdmVyVCR0b3BYJG9iamVjdHMS
AAGGoF8QD05TS2V5ZWRBcmNoaXZlctEICVRyb290gAGjCwwTVSRudWxs0w0ODxARElVO
U1JHQlxOU0NvbG9yU3BhY2VWJGNsYXNzTxAmMC43NDExNzY0ODYgMC41NzY0NzA2MTM1
IDAuOTc2NDcwNTg5NgAQAYAC0hQVFhdaJGNsYXNzbmFtZVgkY2xhc3Nlc1dOU0NvbG9y
@tonyxu-io
tonyxu-io / shadowsocksr-install.md
Last active Feb 5, 2020
ShadowsocksR 一键安装
View shadowsocksr-install.md

ShadowsocksR 一键安装

适配环境: CentOS 6

安装

yum install wget
wget --no-check-certificate https://raw.githubusercontent.com/teddysun/shadowsocks_install/master/shadowsocksR.sh
chmod +x shadowsocksR.sh
@tonyxu-io
tonyxu-io / pkce-generator.html
Last active Apr 30, 2021
PKCE Code Verifier and Code Challenge Generator. DEMO:https://tonyxu-io.github.io/pkce-generator/
View pkce-generator.html
<!DOCTYPE html>
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.9-1/crypto-js.min.js"></script>
<script>
function generateCodeVerifier() {
var code_verifier = generateRandomString(128)
document.getElementById("code_verifier").value = code_verifier
}
View git-reset-author.sh
#!/bin/sh
# Credits: http://stackoverflow.com/a/750191
git filter-branch -f --env-filter "
GIT_AUTHOR_NAME='Newname'
GIT_AUTHOR_EMAIL='new@email'
GIT_COMMITTER_NAME='Newname'
GIT_COMMITTER_EMAIL='new@email'
" HEAD
@tonyxu-io
tonyxu-io / merge-sort-array.js
Last active Jun 25, 2018
Array #DataStructureAlgorithms
View merge-sort-array.js
// Merge two arrays
function merge(arr1, arr2) {
var res = []
while (arr1.length > 0 && arr2.length > 0) {
if (arr1[0] < arr2[0]) {
res.push(arr1.shift())
} else {
res.push(arr2.shift())
}
}
@tonyxu-io
tonyxu-io / _tree.js
Last active Jun 25, 2018
Tree #DataStructureAlgorithms
View _tree.js
// Tree Node Definition
function TreeNode(val) {
this.val = val;
this.left = this.right = null;
}
// Tree Creation
var t = new TreeNode(10)
t.left = new TreeNode(-2)
t.right = new TreeNode(6)
@tonyxu-io
tonyxu-io / linedin-login-sample-code.html
Last active Aug 8, 2020
Linkedin Login Sample Code #snippet
View linedin-login-sample-code.html
<!DOCTYPE html>
<html>
<head>
<title>Linkedin Demo</title>
<meta charset="utf-8">
<script type="text/javascript" src="//platform.linkedin.com/in.js">
api_key: 86012 cynxvvidr
onLoad: checkAuthentication
authorize: true
View google-oauth-login.html
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Index</title>
<button onclick="openWindow()">Login</button>
<pre id="access_token"></pre>
<pre id="tokenInfo"></pre>
<pre id="userInfo"></pre>
@tonyxu-io
tonyxu-io / rest-api-sample-javascript.js
Last active Jun 25, 2018
REST API Call Sample Code #snippet
View rest-api-sample-javascript.js
// Vanilla JS - GET
var xhr = new XMLHttpRequest();
xhr.open('GET', 'https://reqres.in/api/users', true);
xhr.onload = function () {
console.log(xhr.responseText)
};
xhr.send(null);
// Vanilla JS - POST
var xhr = new XMLHttpRequest();
@tonyxu-io
tonyxu-io / vi-cheat-sheet.md
Last active Jun 25, 2018
VIM Cheat Sheet #cheatsheet
View vi-cheat-sheet.md

Cursor movement

h - move left
j - move down
k - move up
l - move right
w - jump by start of words (punctuation considered words)
W - jump by words (spaces separate words)
e - jump to end of words (punctuation considered words)