Skip to content

Instantly share code, notes, and snippets.

View pyk's full-sized avatar
🐈‍⬛
I may be slow to respond.

pyk pyk

🐈‍⬛
I may be slow to respond.
View GitHub Profile
@pyk
pyk / output.md
Last active September 7, 2015 09:34
solution of exercise http://tour.golang.org/#38

image

@pyk
pyk / output
Created May 10, 2014 04:32
Maps exercise solution http://tour.golang.org/#43
PASS
f("I am learning Go!") =
map[string]int{"I":1, "am":1, "learning":1, "Go!":1}
PASS
f("The quick brown fox jumped over the lazy dog.") =
map[string]int{"brown":1, "over":1, "lazy":1, "dog.":1, "The":1, "quick":1, "fox":1, "jumped":1, "the":1}
PASS
f("I ate a donut. Then I ate another donut.") =
map[string]int{"I":2, "ate":2, "a":1, "donut.":2, "Then":1, "another":1}
PASS
@pyk
pyk / resolve.go
Last active August 29, 2015 14:01
package main
import (
"net"
"os"
"fmt"
)
func main() {
// if script running without argument, give usage information
@pyk
pyk / goprompt.sh
Created May 23, 2014 15:05
How to: display Go lang version on Bash prompt
# add this function on your .bashrc file to echoed Go version
function go_version {
version=$(go version)
regex="(go[0-9].[0-9].[0-9])"
if [[ $version =~ $regex ]]; then
echo ${BASH_REMATCH[1]}
fi
}
# and add to your PS1, for example
@pyk
pyk / display.md
Last active August 29, 2015 14:01
customize tab on ubuntu terminal

display

@pyk
pyk / CardTransformer.java
Last active April 9, 2016 16:32
ViewPager.PageTransformer custom animation
/*
Usage:
viewPager.setPageTransformer(true, new CardTransformer(0.7f));
*/
public class CardTransformer implements PageTransformer {
private final float scalingStart;
public CardTransformer(float scalingStart) {
super();
package your_package;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.app.Activity;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
[Desktop Entry]
Version=0.1
Name=Processing
Comment=Processing
Exec=/path/to/exec/processing
Icon=/path/to/exec/lib/icon/some.png
Terminal=false
Type=Application
Categories=Application;
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<title>Wisdom - Startup Quote API</title>
<!-- Bootstrap -->
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" rel="stylesheet">
@pyk
pyk / plot.p
Created February 7, 2015 03:48
gnuplot template
# The graph title
set title "Request time benchmark by pyk at github"
# legend/key
set key right top
# label x & y axis
set xlabel "requests"
set ylabel "ttime (ms)"