Skip to content

Instantly share code, notes, and snippets.

View liango2's full-sized avatar
🌴
On vacation

liango2

🌴
On vacation
View GitHub Profile
@liango2
liango2 / intro.md
Created August 27, 2016 17:26 — forked from derhuerst/intro.md
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.

@liango2
liango2 / git乱码解决方案汇总.txt
Created August 13, 2016 14:19 — forked from xkyii/git乱码解决方案汇总.txt
git乱码解决方案汇总
原帖地址: http://topic.csdn.net/u/20110113/19/b0d5d506-4307-428b-a61d-7974aa66a2da.html
首先要说明的是:这里介绍的方法都是大部分是本人“悟”出来的,所以网上难有流传!
好方法不能自己私藏,否则就白忙乎这几天了,分享给有需要的朋友们。如果有转载,敬请注明来自*CSDN老邓*作品。
呵呵,给自己打广告,实在是无耻之极,权当无聊之时打字之用。
欢迎流传,为最优秀的分布式版本管理系统Git做宣传!!
步骤:
1. 下载:http://loaden.googlecode.com/files/gitconfig.7z
2. 解压到:<MsysGit安装目录>/cmd/,例如:D:\Program Files\Git\cmd
@liango2
liango2 / shrug.ahk
Created July 31, 2016 15:31 — forked from dieseltravis/shrug.ahk
autohotkey script to replace 🤷 with ¯\_(ツ)_/¯ (and a few other common unicode art emoji)
; :shrug: ¯\_(ツ)_/¯
:B0:`:shrug::
if (A_EndChar == ":") {
SendInput, {BS 7}¯\_(ツ)_/¯
}
return
; :whatever: ◔_◔
:B0:`:whatever::
@liango2
liango2 / github.bash
Created May 13, 2016 00:16 — forked from igrigorik/github.bash
Open GitHub URL for current directory/repo...
alias gh="open \`git remote -v | grep [email protected] | grep fetch | head -1 | cut -f2 | cut -d' ' -f1 | sed -e's/:/\//' -e 's/git@/http:\/\//'\`"

This is an adaptation of https://twitter.com/jasonneylon 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
liango2 / PlusMinus.scala
Created January 14, 2016 21:04
统计给定Array[Int]数组中正数, 负数, 0所占的比, 依次(正数, 然后负数,然后0)打印结果,使用小数表示即可
object Solution {
def main(args: Array[String]) {
val sc = new java.util.Scanner (System.in);
var n = sc.nextInt();
var arr = new Array[Int](n);
for(arr_i <- 0 to n-1) {
arr(arr_i) = sc.nextInt();
}
@liango2
liango2 / DiagonalDifference
Created January 14, 2016 18:29
DiagonalDifference
object Solution {
def main(args: Array[String]) {
val sc = new java.util.Scanner(System.in);
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();
}
@liango2
liango2 / aVeryBigSum.scala
Created January 14, 2016 18:24
A Very Big Sum
object Solution {
def main(args: Array[String]) {
val sc = new java.util.Scanner(System.in);
var n = sc.nextInt();
var arr = new Array[Int](n);
for (arr_i <- 0 to n - 1) {
arr(arr_i) = sc.nextInt();
}
println(arr.map(_.toLong).sum)
@liango2
liango2 / SCombinator.scala
Created January 13, 2016 19:19 — forked from folone/SCombinator.scala
Y-Combinator in 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
liango2 / assert
Created December 30, 2015 13:28 — forked from maximn/assert
Scala preconditions
val rnd = Math.random()
val n = Math.abs(rnd)
assert(n > 0)