Skip to content

Instantly share code, notes, and snippets.

💭
I may be slow to respond.

小龙同学 longkai

View GitHub Profile
@longkai
longkai / Dockerfile
Last active Apr 17, 2018
shadowsocks-libev with simple obfs in a single docker image
View Dockerfile
#
# Dockerfile for shadowsocks-libev
#
FROM alpine
MAINTAINER longkai <i@xiaolongtongxue.com>
ENV SERVER_ADDR 0.0.0.0
ENV SERVER_PORT 8388
ENV PASSWORD=
@longkai
longkai / stack.c
Last active Dec 11, 2016
A simple dynamic stack written in C.
View stack.c
#include <stdio.h>
#include "stack.h"
#define STACK_SIZE 5 // or larger, e.g. 1024 ptrs
#define PTR_SIZE sizeof(uintptr_t)
static void err_sys(const char *msg);
void stack_init(Stack *s) {
@longkai
longkai / gocp.sh
Created Sep 8, 2016
A simple golang cross compile script
View gocp.sh
#!/bin/sh
# A simple golang(go 1.5+) cross compile script.
# Usage `gocp.sh [os] [version]`, default OS linux/mac/freebsd/window 64 binary with bzip2 format or zip(only windows) compression format with `latest` version.
# output pattern `os-arch-version.tar.bz2` or `os-arch-version.zip`
name=${PWD##*/}
v=$2
@longkai
longkai / intellij-keymap-mac.md
Last active Aug 18, 2016
Relearning Intellij keymap for mac only
View intellij-keymap-mac.md

Intellij Keymap

Eidting

key decription
⇧ F1 External Doc(not work for all source)
⌘ F1 Show descriptions of error or warning at caret
⌘ N Generate code...
^ O Override methods
^ I Implement methods
View InteractingListenViewPager.java
package com.xiaolongtongxue.vp1;
import android.content.Context;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.view.MotionEvent;
/**
* A customized view pager which listens when user is interacting with itself.
*/
@longkai
longkai / QuickReturnRecyclerOnScrollListener.java
Created Apr 23, 2015
A simple RecyclerView scrolling tricks.
View QuickReturnRecyclerOnScrollListener.java
/*
* The MIT License (MIT)
*
* Copyright (c) 2015 longkai
*
* The software shall be used for good, not evil.
*/
package android.support.animation;
@longkai
longkai / LineThroughTextView.java
Created Mar 28, 2015
A simple line through text view. ie. ----------------- Hello, World --------------
View LineThroughTextView.java
/*
* The MIT License (MIT)
*
* Copyright (c) 2015 longkai
*
* The software shall be used for good, not evil.
*/
package android.support.widget;
@longkai
longkai / LogoView.java
Created Mar 28, 2015
A logo view with an isosceles triangle. To use it, provide you distinct angle and the largest edge.
View LogoView.java
/*
* The MIT License (MIT)
*
* Copyright (c) 2015 longkai
*
* The software shall be used for good, not evil.
*/
package android.support.widget;
@longkai
longkai / FloatingLabelLayout.java
Created Mar 27, 2015
A floating label view which shows some labels on top of the first child.
View FloatingLabelLayout.java
/*
* The MIT License (MIT)
*
* Copyright (c) 2015 longkai
*
* The software shall be used for good, not evil.
*/
package com.example.app.layout;
@longkai
longkai / EmptyRecyclerView.java
Created Mar 4, 2015
A wrapped {@link android.support.v7.widget.RecyclerView} view with an empty view functionality like {@link android.widget.ListView}
View EmptyRecyclerView.java
/*
* The MIT License (MIT)
*
* Copyright (c) 2015 longkai
*
* The software shall be used for good, not evil.
*/
package com.example.widget;
You can’t perform that action at this time.