Skip to content

Instantly share code, notes, and snippets.

Working from home

liu lei leolovenet

Working from home
View GitHub Profile
leolovenet / Self-Documented Makefile
Last active Nov 27, 2020
Automatically have "make help" print the usage of your Makefile. from
View Self-Documented Makefile
##@ Dependencies
.PHONY: deps
deps: ## Check dependencies
$(info Checking and getting dependencies)
View fishshell, man pages with colors
#add this function to your $HOME/.config/fish/
function man
set -x LESS_TERMCAP_mb (printf "\e[01;32m")
set -x LESS_TERMCAP_md (printf "\e[01;32m")
set -x LESS_TERMCAP_me (printf "\e[0m")
set -x LESS_TERMCAP_se (printf "\e[0m")
set -x LESS_TERMCAP_so (printf "\e[01;33m")
set -x LESS_TERMCAP_ue (printf "\e[0m")
set -x LESS_TERMCAP_us (printf "\e[1;4;31m")
leolovenet / net.Listener.SetsockoptInt.IP_TRANSPARENT.for.Linux.go
Created Oct 21, 2018
SetsockoptInt IP_TRANSPARENT for net.Listener in golang
View net.Listener.SetsockoptInt.IP_TRANSPARENT.for.Linux.go
package main
import (
leolovenet / fishshell luarocks path
Last active Jun 27, 2020
luarocks path command for fishshell
View fishshell luarocks path
for i in (luarocks path | awk '{sub(/PATH=/, "PATH ", $2); print "set -gx "$2}'); eval $i; end
leolovenet /
Created Jul 6, 2016
IPSEC VPN on Centos6 with StrongSwan for iOS9
## Main reference
yum -y install epel-release
yum -y install haveged strongswan
/etc/init.d/haveged start
chkconfig haveged on
cd /etc/strongswan || exit
cat > strongswan.conf <<'EOF'
View zipzag.c
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <unistd.h>
typedef unsigned char byte;
leolovenet /
Last active Aug 29, 2015
jQuery Knob draw with animation
* Created by on 7/2/15.
"use strict";
var Circles = function(e,op) {
this.options = $.extend({}, Circles.DEFAULTS, op);
this.$e = $(e);
leolovenet /
Last active Jun 11, 2016
make terminal colors
cd ~
WGET_CMD=$(type -P wget)
if [ "X$WGET_CMD" = "X" ];then
yum -y install wget coreutils
if [ ! -f ~/.dir_colors ]; then
leolovenet /
Created Mar 28, 2014
一个检测 Linux 服务器硬件资源脚本,包含服务器的型号,U 数,Dell 序列号,内存数,最大内存数,可以插的内存条数,已经用的内存条数,内存类型,硬盘大小,CPU 信息. A Linux server hardware detection resource script that contains the server model, U number, Dell serial number, the number of memory, the maximum amount of memory, the memory can be inserted in the number, the number of memory has been used, the type of memo…
ISINSTALLED_D=$(rpm -qa |grep dmidecode)
if [ -z $ISINSTALLED_D ]; then
yum -y install dmidecode
export PATH=$HOME/bin:/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin
leolovenet / commentdel
Created Feb 23, 2014
use this script to remove comment line in config file. e.g. $commentdel nginx.conf
View commentdel
#set -x
if [ $# -lt 1 ]; then
echo "Usage: $0 < filepath > [ \# | \; | \/\/ | \<other comment sign>, default: \# ]"
exit 1;
if [ ! -f ${CONFIG_FILE} ]; then
You can’t perform that action at this time.