Skip to content

Instantly share code, notes, and snippets.

On vacation


On vacation
Block or report user

Report or block liango2

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
liango2 /
Created Aug 27, 2016 — forked from derhuerst/
Installing the Z Shell (zsh) on Linux, Mac OS X and Windows

Installing zsh – the easy way

The Z shell (zsh) is a Unix shell [...]. Zsh can be thought of as an extended Bourne shell with a large number of improvements, including some features of bash, ksh, and tcsh.

Z shell – Wikipedia

Read more about ZSH at An Introduction to the Z Shell.

Choose one of the following options.

View git乱码解决方案汇总.txt
1. 下载:
2. 解压到:<MsysGit安装目录>/cmd/,例如:D:\Program Files\Git\cmd
liango2 / shrug.ahk
Created Jul 31, 2016 — forked from dieseltravis/shrug.ahk
autohotkey script to replace :shrug: with ¯\_(ツ)_/¯ (and a few other common unicode art emoji)
View shrug.ahk
; :shrug: ¯\_(ツ)_/¯
if (A_EndChar == ":") {
SendInput, {BS 7}¯\_(ツ)_/¯
; :whatever: ◔_◔
liango2 / github.bash
Created May 13, 2016 — forked from igrigorik/github.bash
Open GitHub URL for current directory/repo...
View github.bash
alias gh="open \`git remote -v | grep | grep fetch | head -1 | cut -f2 | cut -d' ' -f1 | sed -e's/:/\//' -e 's/git@/http:\/\//'\`"

This is an adaptation of script.

In the terminal window, you can open your current repo (at the current branch) in your default browser.

My adaptation was adding options to view the commits, branches, pull requests or issues for the repo using one of the additional options (added support for wiki, settings, pulse, graphs, network):

[h]               => View help
[c]               => View commits
[c {SHA}]         => View specific commit from commit SHA
[b]               => View branches
liango2 / PlusMinus.scala
Created Jan 14, 2016
统计给定Array[Int]数组中正数, 负数, 0所占的比, 依次(正数, 然后负数,然后0)打印结果,使用小数表示即可
View PlusMinus.scala
object Solution {
def main(args: Array[String]) {
val sc = new java.util.Scanner (;
var n = sc.nextInt();
var arr = new Array[Int](n);
for(arr_i <- 0 to n-1) {
arr(arr_i) = sc.nextInt();
View DiagonalDifference
object Solution {
def main(args: Array[String]) {
val sc = new java.util.Scanner(;
var n = sc.nextInt();
var a = Array.ofDim[Int](n, n);
for (a_i <- 0 to n - 1) {
for (a_j <- 0 to n - 1) {
a(a_i)(a_j) = sc.nextInt();
View aVeryBigSum.scala
object Solution {
def main(args: Array[String]) {
val sc = new java.util.Scanner(;
var n = sc.nextInt();
var arr = new Array[Int](n);
for (arr_i <- 0 to n - 1) {
arr(arr_i) = sc.nextInt();
liango2 / SCombinator.scala
Created Jan 13, 2016 — forked from folone/SCombinator.scala
Y-Combinator in Scala
View SCombinator.scala
* <b>Fixed Point Combinator is:</b>
* Y = λf.(λx.f (x x)) (λx.f (x x))
* <b>Proof of correctness:</b>
* Y g = (λf . (λx . f (x x)) (λx . f (x x))) g (by definition of Y)
* = (λx . g (x x)) (λx . g (x x)) (β-reduction of λf: applied main function to g)
* = (λy . g (y y)) (λx . g (x x)) (α-conversion: renamed bound variable)
* = g ((λx . g (x x)) (λx . g (x x))) (β-reduction of λy: applied left function to right function)
* = g (Y g) (by second equality) [1]
liango2 / assert
Created Dec 30, 2015 — forked from maximn/assert
Scala preconditions
View assert
val rnd = Math.random()
val n = Math.abs(rnd)
assert(n > 0)
You can’t perform that action at this time.