Skip to content

Instantly share code, notes, and snippets.

View justintien's full-sized avatar
🍞
Jiapan

Justin Tien (Yi-Ming Tien) justintien

🍞
Jiapan
View GitHub Profile
@justintien
justintien / git_rename.sh
Created June 15, 2018 01:32 — forked from robotdana/git_rename.sh
Use git .mailmap
#!/bin/bash
# based on: https://gist.github.com/octocat/0831f3fbd83ac4d46451#gistcomment-2178506
# will use the .mailmap file to rewrite all names/emails
function correct_names () {
( git shortlog -sen ; git shortlog -secn ) | cut -f2 | sort | uniq
}
function all_names () {
( git log --format="%an <%ae>" ; git log --format="%cn <%ce>" ) | sort | uniq
@justintien
justintien / plantuml.puml
Created May 30, 2018 02:00 — forked from dlebrero/plantuml.puml
A PlantUML example
@startuml
actor browser
participant nginx
participant backend
participant keycloak
browser -> nginx: /library (558.0B)
browser <-- nginx: 304 (266.0B)
browser -> backend: /api/library (464.0B)
browser <-- backend: 302 [OAuth_Token_Request_State] (547.0B)
@justintien
justintien / uuid.js
Created May 28, 2018 03:41 — forked from jcxplorer/uuid.js
UUID v4 generator in JavaScript (RFC4122 compliant)
function uuid() {
var uuid = "", i, random;
for (i = 0; i < 32; i++) {
random = Math.random() * 16 | 0;
if (i == 8 || i == 12 || i == 16 || i == 20) {
uuid += "-"
}
uuid += (i == 12 ? 4 : (i == 16 ? (random & 3 | 8) : random)).toString(16);
}
@justintien
justintien / .vimrc
Created May 15, 2018 02:13 — forked from JeffreyWay/.vimrc
My .vimrc file
set nocompatible " Disable vi-compatibility
set t_Co=256
colorscheme xoria256
set guifont=menlo\ for\ powerline:h16
set guioptions-=T " Removes top toolbar
set guioptions-=r " Removes right hand scroll bar
set go-=L " Removes left hand scroll bar
set linespace=15
@justintien
justintien / gist:7bacd8031baa62a05b1939197b6dd220
Created May 11, 2018 07:50 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: πŸ˜„ :smile: πŸ˜† :laughing:
😊 :blush: πŸ˜ƒ :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
πŸ˜† :satisfied: 😁 :grin: πŸ˜‰ :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: πŸ˜€ :grinning:
πŸ˜— :kissing: πŸ˜™ :kissing_smiling_eyes: πŸ˜› :stuck_out_tongue:
var CryptoJS = require('crypto-js')
var request = require('request-promise')
/*
* npm install crypto-js request-promise request
* node wx_t1t_hack.js
*/
// export function testEncription(msg, fullKey) {
// var fullKey = fullKey.slice(0, 16)
@justintien
justintien / logger.js
Created April 27, 2018 06:10 — forked from prantlf/logger.js
Logger Library with winston - Fixed for additional log arguments
var app = require(process.cwd() + '/app');
var winston = require('winston');
var _ = require('lodash');
// Set up logger
var customColors = {
trace: 'white',
debug: 'green',
info: 'green',
warn: 'yellow',
@justintien
justintien / mysql-docker.sh
Created February 27, 2018 01:19 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@justintien
justintien / sample-php-headers.php
Created January 10, 2018 14:46
PHP Header Examples
301 moved permanently (redirect):
<?php
header('HTTP/1.1 301 Moved Permanently');
header('Location: http://www.example.com');
die();
?>
302 moved temporarily(redirect):
<?php
header('Location: http://www.example.com');
@justintien
justintien / .curlrc
Created January 9, 2018 01:04 — forked from asmega/.curlrc
default proxy for curl in .curlrc
proxy=http://username:password@host:port