Skip to content

Instantly share code, notes, and snippets.

View qinshulei's full-sized avatar
🎯
Focusing

Qin Shulei qinshulei

🎯
Focusing
View GitHub Profile
@qinshulei
qinshulei / ubuntu-xenial-armfh-qemu.md
Created March 23, 2017 02:43 — forked from takeshixx/ubuntu-xenial-armfh-qemu.md
Running Ubuntu 16.04.1 armhf on Qemu

Running Ubuntu 16.04.1 armhf on Qemu

This is a writeup about how to install Ubuntu 16.04.1 Xenial Xerus for the 32-bit hard-float ARMv7 (armhf) architecture on a Qemu VM via Ubuntu netboot.

The setup will create a Ubuntu VM with LPAE extensions (generic-lpae) enabled. However, this writeup should also work for non-LPAE (generic) kernels.

The performance of the resulting VM is quite good, and it allows VMs with >1G ram (compared to 256M on versatilepb and 1G on versatile-a9/versatile-a15). It also supports virtio disks whereas versatile-a9/versatile-a15 only support SD cards via the -sd argument.

Get netboot files

@qinshulei
qinshulei / Description.md
Created March 8, 2017 03:18 — forked from juanje/Description.md
Limit Chrome from eating all the memory and CPU

I was tired of Chrome eating all my laptop resources so I decided to put some limit to it with cgroup.

As I was using Ubuntu 12.04 with support for cgroup, I installed the package cgroup-bin and add the following group to the file /etc/cgconfig.conf:

group browsers {
    cpu {
#       Set the relative share of CPU resources equal to 25%
        cpu.shares = "256";
 }
@qinshulei
qinshulei / parallel workflow
Last active August 26, 2016 09:02 — forked from michaelneale/parallel workflow
jenkins pipeline parallel example
stage "preparation"
node {
parallel (
phase1: { sh "echo p1; echo phase1" },
phase2: { sh "echo p2; echo phase2" }
)
sh "echo 42 > data"
stash includes: '*', name: 'binary'
@qinshulei
qinshulei / ginger-api.el
Created June 3, 2016 10:28 — forked from syohex/ginger-api.el
ginger API from Emacs
(require 'request) ;; https://github.com/tkf/emacs-request
(require 'json)
(defvar ginger-end-point
"http://services.gingersoftware.com/Ginger/correct/json/GingerTheText" )
;;;###autoload
(defun ginger-region (beg end)
(interactive "r")
(lexical-let* ((text (buffer-substring-no-properties beg end))
@qinshulei
qinshulei / .bashrc
Created May 30, 2016 07:02
Some changes into .bashrc to se git on path and to use tmux better
# GIT
# Download this file https://raw.githubusercontent.com/git/git/master/contrib/completion/git-prompt.sh to ~/.git-prompt.sh
source ~/.git-prompt.sh
export PS1='\[\e[1;33m\]'$PS1'\[\e[1;32m\]$(__git_ps1 "(%s) ")\[\e[m\]'
# TMUX
export TERM=xterm-256color
@qinshulei
qinshulei / SimpleHTTPServerWithUpload.py
Created April 12, 2016 07:24 — forked from UniIsland/SimpleHTTPServerWithUpload.py
Simple Python Http Server with Upload
#!/usr/bin/env python
"""Simple HTTP Server With Upload.
This module builds on BaseHTTPServer by implementing the standard GET
and HEAD requests in a fairly straightforward manner.
"""
@qinshulei
qinshulei / git aliases.sh
Created April 6, 2016 06:53 — forked from tj/git aliases.sh
Some helpful git aliases
alias gd="git diff"
alias gc="git clone"
alias ga="git add"
alias gbd="git branch -D"
alias gst="git status"
alias gca="git commit -a -m"
alias gpt="git push --tags"
alias gp="git push"
alias gpr="git pull-request"
alias grh="git reset --hard"
@qinshulei
qinshulei / eclipse_checkstyle560_android.xml
Created January 8, 2016 06:05 — forked from fredgrott/eclipse_checkstyle560_android.xml
eclipse checkstyle 5.6.0 forandroid
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN" "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<!--
This configuration file was written by the eclipse-cs plugin configuration editor
-->
<!--
Checkstyle-Configuration: Android Checks (Eclipse)
Description:
Slightly modified version of Sun Checks that better matches the default code formatter setting of Eclipse.
@qinshulei
qinshulei / 0x8B1F
Created December 17, 2015 13:51 — forked from zealic/Email
Please use CAPTCHA as additional message
H4sIAAAAAAAAA6VRybKiQBC88xXvPofpBhE4zKEaBRFRG2xAbjQNiGwaLghfPxgx
fzB5qIrKyKglK1WypZrJhraQNVQIZCh5rqcGL/Q01wTiPylKkY6KhZwvC6xwJZXF
nJUCaQoyVCF+loYuVJxiQ+gplnGWqzpeGIbQuIbwcqlLf/4TUsU+6WmAvXnp3fUK
SgoNwFAfPAADvrCSxj+IKGGnDsxfmJzQlwznQHb+b09KYmickXxEFE7Cbt688148
oq5ZeVfH2pRQgmOW/WdXEZbarDxH6iTkcHQ2/tuxPzcpadljLjwoP5i3jZzE2ykJ
hq+wduxwD3HtEApTGqndcejHuZHDlazkkfXKA9JJWWs9s5G8k4pMXAkfs2iaRSVF
xoEii7lr/yJs9vK77ZuzZ5PH4p21tHdqYYcjmaRkXimGHkhA6nNcV26g2lzZPs/x
V4T3iU1nbiivQ3KYJ3fnryu2/+SBc3MjUkhWRVw+0GJlkpANN58FZJO1Bs5Wveve
gUBFXiLCVeSLG1TO3X3To3n1Ri8gR+9EsbQ3iemdiAWr9RHM+u7WtR2Ws4l20843
rmhIGEUXkgGvrXLoaJA9nLV1YFhYrLr4khfU/Y7C6AYIPIX6awr/MP/4L1driBiI
@qinshulei
qinshulei / gist:9a5d57bcc42ffecfcb42
Last active August 29, 2015 14:26 — forked from fungusakafungus/gist:1026804
bash retry function
function retry {
local retry_max=$1
shift
local count=$retry_max
while [ $count -gt 0 ]; do
"$@" && break
count=$(($count - 1))
sleep 1
done