Skip to content

Instantly share code, notes, and snippets.

View qinshulei's full-sized avatar
🎯
Focusing

Qin Shulei qinshulei

🎯
Focusing
View GitHub Profile

Commit Message Format

Each commit message consists of a header, a body and a footer. The header has a special format that includes a type, a scope and a subject:

<type>(<scope>): <subject>
<BLANK LINE>
<body>
<BLANK LINE>
// Add a 401 response interceptor
window.axios.interceptors.response.use(function (response) {
return response;
}, function (error) {
if (401 === error.response.status) {
swal({
title: "Session Expired",
text: "Your session has expired. Would you like to be redirected to the login page?",
type: "warning",
showCancelButton: true,
@qinshulei
qinshulei / install-packages.sh
Created April 12, 2020 06:37 — forked from Musinux/install-packages.sh
VNC xstartup for unity
#!/bin/bash
sudo apt-get install vnc4server ubuntu-desktop
sudo apt-get install gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal
@qinshulei
qinshulei / flush-dns.sh
Created August 15, 2019 05:04 — forked from craigvantonder/flush-dns.sh
Flushing the DNS in Ubuntu 16.04
#!/bin/bash
# NB: First install nscd with sudo apt-get install nscd
# run this command to flush dns cache:
sudo /etc/init.d/dns-clean restart
# or use:
sudo /etc/init.d/networking force-reload
# Flush nscd dns cache:
sudo /etc/init.d/nscd restart
@qinshulei
qinshulei / multiple_ssh_setting.md
Created May 21, 2018 09:15 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "[email protected]"
@qinshulei
qinshulei / rproxy.sh
Created May 9, 2018 12:32 — forked from Sid3y1/rproxy.sh
nginx reverse proxy script
#!/bin/bash
if [[ ! $3 ]]
then
echo "Usage ./rproxy.sh name ip port"
exit 1
fi
if [[ -f /etc/nginx/sites-enabled/$1 ]]
then
@qinshulei
qinshulei / gist:b0fb408c9a90aebbf9e98ef2f624490b
Created September 27, 2017 03:36
第18位身份证号生成算法
(require 'cl-lib)
(defun personal-identity-last-bit (n)
;; 1. S = sum(item(i) * weight(i))
;; 2. Y = mod(S, 11)
;; 3. M = map(Y, r)
(let ((bits (mapcar 'string-to-number
(mapcar 'char-to-string n)))
(weights '(7 9 10 5 8 4 2 1 6 3 7 9 10 5 8 4 2))
(map-result '(1 0 "X" 9 8 7 6 5 4 3 2)))
@qinshulei
qinshulei / source.py
Created June 7, 2017 05:46 — forked from mammadori/source.py
Python: "source" a shell script and read variables
from subprocess import Popen, PIPE
from os import environ
def source(script, update=True, clean=True):
"""
Source variables from a shell script
import them in the environment (if update==True)
and report only the script variables (if clean==True)
"""
This document describes about installation and configuration of IPMI simulator.
We need: qemu-kvm, OpenIPMI, OpenIPMI-tools
1) Install the qemu-kvm. We need the qemu, which have the IPMI pacthes.
Use the source https://github.com/cminyard/qemu/tree/stable-2.2-ipmi
./configure, make and make install
2) Download the OpenIPMI libraries, from http://sourceforge.net/projects/openipmi/
Follow the process documented in lanserv/README.vm
./configure --prefix=/opt/openipmi/usr --sysconfdir=/opt/openipmi/etc \
--with-perlinstall=/opt/openipmi/usr/lib/perl \