Skip to content

Instantly share code, notes, and snippets.

@ishitcno1
ishitcno1 / setup.sh
Last active November 22, 2016 10:28
Setup a Linux server. Install docker and jenkins.
#!/bin/bash
# Set LC_CTYPE
echo 'LC_CTYPE="en_US.UTF-8"' >> /etc/default/locale
source /etc/default/locale
# Install docker
apt-get update
apt-get install apt-transport-https ca-certificates
apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" | tee /etc/apt/sources.list.d/docker.list
@ishitcno1
ishitcno1 / v2ex_sign.py
Created November 18, 2016 01:53 — forked from za2016/v2ex_sign.py
v2ex自动签到小脚本
#-*- coding=utf-8 -*-
import requests
import re
import sys
reload(sys)
sys.setdefaultencoding('utf8')
signin='http://v2ex.com/signin'
home='http://v2ex.com'
@ishitcno1
ishitcno1 / 51-android.rules
Created May 8, 2016 07:33
Android udev rules for linux
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ENV{PRODUCT}=="2207/*", MODE="0666"
# Acer
SUBSYSTEM=="usb", ATTR{idVendor}=="0502", MODE="0666", GROUP="plugdev"
# ASUS
SUBSYSTEM=="usb", ATTR{idVendor}=="0b05", MODE="0666", GROUP="plugdev"
# Dell
SUBSYSTEM=="usb", ATTR{idVendor}=="413c", MODE="0666", GROUP="plugdev"
@ishitcno1
ishitcno1 / xenial_ustc.list
Created May 7, 2016 08:54
Ubuntu Xenial ustc sources.list
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
@ishitcno1
ishitcno1 / ClassChecker.java
Last active March 31, 2016 11:59
Print all features of a class
import java.lang.reflect.*;
import java.util.Scanner;
/**
* Print all features of a class
* Created by albert on 2016/3/31.
*/
public class ClassChecker {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
@ishitcno1
ishitcno1 / app.js
Created September 25, 2015 13:50
guoxue123.cn book downloader
/** Download books from www.guoxue123.cn
* usage: node downloader.js <index page>
* example: node downloader.js www.guoxue123.cn/xiaosuo/jd/jpshz/index.htm
*/
var http = require('http');
var url = require('url');
var parser = require('cheerio');
var iconv = require('iconv').Iconv('GBK', 'UTF-8');
var fs = require('fs');
@ishitcno1
ishitcno1 / .gitconfig
Last active August 29, 2015 14:22
gitconfig
[user]
email = [email protected]
name = ishitcno1
[alias]
aa = add -A
b = branch
l = log
mm = commit -m
ma = commit --amend
s = status
@ishitcno1
ishitcno1 / DialView.java
Created June 4, 2015 03:57
android dial view
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.Point;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.SweepGradient;
@ishitcno1
ishitcno1 / methods.js
Created April 24, 2015 03:26
nodejs get ipv4 ip
var os = require('os');
var ip = '127.0.0.1';
os.networkInterfaces().wlan0.forEach(function(ni) {
if (ni.family === 'IPv4')
ip = ni.address;
});
@ishitcno1
ishitcno1 / Method.java
Created April 14, 2015 10:43
android display width height
DisplayMetrics displaymetrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
int height = displaymetrics.heightPixels;
int width = displaymetrics.widthPixels;