Skip to content

Instantly share code, notes, and snippets.

yinchuan

Block or report user

Report or block yinchuan

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@yinchuan
yinchuan / gist:3be3ae0f0bccd94725c6744b6adddd2e
Created Oct 3, 2017 — forked from mbn18/gist:0d6ff5cb217c36419661
How to install nsenter on Ubuntu 14.04
View gist:3be3ae0f0bccd94725c6744b6adddd2e
# Ubuntu 14.04 don't have nsenter - the straight forward way required me to install build tools and etc.
# I preferred to keep the system clean and install nsenter in a container and then copy the command to the host
# Note - its also possible to run nsenter from a container (didn't tried) https://github.com/jpetazzo/nsenter
# start a container
docker run --name nsenter -it ubuntu:14.04 bash
## in the docker
apt-get update
apt-get install git build-essential libncurses5-dev libslang2-dev gettext zlib1g-dev libselinux1-dev debhelper lsb-release pkg-config po-debconf autoconf automake autopoint libtool
@yinchuan
yinchuan / bash-template
Created Apr 8, 2016 — forked from renzok/bash-template
A template bash script based on google style guide with little improvements
View bash-template
#!/bin/bash
# Here short description of this script
# This is just a template to be used for writing new bash scripts
###
# Based on Google Style Guide: https://google-styleguide.googlecode.com/svn/trunk/shell.xml
# General remarks
# * Executables should have no extension (strongly preferred) or a .sh extension.
# * Libraries must have a .sh extension and should not be executable
View backup-github.sh
#!/bin/bash
# A simple script to backup an organization's GitHub repositories.
GHBU_BACKUP_DIR=${GHBU_BACKUP_DIR-"github-backups"} # where to place the backup files
GHBU_ORG=${GHBU_ORG-"<CHANGE-ME>"} # the GitHub organization whose repos will be backed up
GHBU_UNAME=${GHBU_UNAME-"<CHANGE-ME>"} # the username of a GitHub account (to use with the GitHub API)
GHBU_PASSWD=${GHBU_PASSWD-"<CHANGE-ME>"} # the password for that account
GHBU_GITHOST=${GHBU_GITHOST-"<CHANGE-ME>.github.com"} # the GitHub hostname (see comments)
GHBU_PRUNE_OLD=${GHBU_PRUNE_OLD-true} # when `true`, old backups will be deleted
GHBU_PRUNE_AFTER_N_DAYS=${GHBU_PRUNE_AFTER_N_DAYS-3} # the min age (in days) of backup files to delete
@yinchuan
yinchuan / download_voa.py
Last active Dec 20, 2015
下载VOA慢速英语的脚本,下载内容保存在D:\VOA目录下。
View download_voa.py
# -*- coding: utf8 -*-
# 下载速度很慢,
import urllib2, urllib
import sys
import os
import socket
import re
import socks
@yinchuan
yinchuan / gist:3402124
Created Aug 20, 2012
SQL Server中随机生成指定范围的日期和时间
View gist:3402124
DECLARE @insert_date datetime;
SET @insert_date = GETDATE();
SET @insert_date = @insert_date + rand() * 1.0/24
You can’t perform that action at this time.