Skip to content

Instantly share code, notes, and snippets.

🌴
On vacation

liango2

🌴
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
liango2 / intro.md
Created Aug 27, 2016 — forked from derhuerst/intro.md
Installing the Z Shell (zsh) on Linux, Mac OS X and Windows
View intro.md

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
原帖地址: 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 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: ¯\_(ツ)_/¯
:B0:`:shrug::
if (A_EndChar == ":") {
SendInput, {BS 7}¯\_(ツ)_/¯
}
return
; :whatever: ◔_◔
:B0:`:whatever::
@liango2
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 git@github.com | grep fetch | head -1 | cut -f2 | cut -d' ' -f1 | sed -e's/:/\//' -e 's/git@/http:\/\//'\`"
View Github_terminal.md

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 Jan 14, 2016
统计给定Array[Int]数组中正数, 负数, 0所占的比, 依次(正数, 然后负数,然后0)打印结果,使用小数表示即可
View PlusMinus.scala
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();
}
View 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();
}
View aVeryBigSum.scala
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 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
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.