Skip to content

Instantly share code, notes, and snippets.

liuduoyu liuyu121

Block or report user

Report or block liuyu121

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
@liuyu121
liuyu121 / git-branches-by-commit-date.sh
Last active Aug 28, 2015 — forked from jasonrudolph/git-branches-by-commit-date.sh
List remote Git branches and the last commit date for each branch. Sort by most recent commit date.
View git-branches-by-commit-date.sh
# Credit http://stackoverflow.com/a/2514279
for branch in `git branch -r | grep -v HEAD`;do echo -e `git show --format="%ci %cr" $branch | head -n 1` \\t$branch; done | sort -r
@liuyu121
liuyu121 / install-lnmp-env@ubuntu.sh
Created Jul 23, 2015
install latest LNMP + redis + etc.
View install-lnmp-env@ubuntu.sh
sudo apt-get install python-software-properties
sudo apt-get install software-properties-common
# install nginx
# add the repository ppa
sudo add-apt-repository ppa:nginx/stable
sudo add-apt-repository ppa:ondrej/php5-oldstable
sudo add-apt-repository ppa:ondrej/php5
View gist:5f9990851dd046be9840
#!/bin/bash
BUILDDIR=/tmp/phpimapmountainlion
# Original Script found at:
# http://blog.vucica.net/2012/10/installing-imap-extension-for-php-on-mountain-lion.html
mkdir "$BUILDDIR"
echo " "
echo "= FETCHING AND INSTALLING IMAP"
View UUID.php
<?php
/**
* UUID class
*
* The following class generates VALID RFC 4122 COMPLIANT
* Universally Unique IDentifiers (UUID) version 3, 4 and 5.
*
* UUIDs generated validates using OSSP UUID Tool, and output
* for named-based UUIDs are exactly the same. This is a pure
* PHP implementation.
View pdf2jpg.sh
#!/bin/bash
# Script to convert PDF file to JPG images
#
# Dependencies:
# * pdftk
# * imagemagick
PDF=$1
@liuyu121
liuyu121 / linux_create_user
Last active Aug 29, 2015
linux create user
View linux_create_user
#!/bin/bash
# @see http://www.cyberciti.biz/tips/howto-write-shell-script-to-add-user.html
# Script to add a user to Linux system
if [ $(id -u) -eq 0 ]; then
read -p "Enter username : " username
read -s -p "Enter password : " password
egrep "^$username" /etc/passwd >/dev/null
if [ $? -eq 0 ]; then
echo "$username exists!"
exit 1
@liuyu121
liuyu121 / replay_163_yum_repo.sh
Last active Aug 29, 2015
Use the 163 yum repo on cetnos 6.5
View replay_163_yum_repo.sh
#!/bin/bash
wget http://mirrors.163.com/.help/CentOS6-Base-163.rep
cd /etc/yum.repos.d/
## !important backup the system yum repo
mv CentOS-Base.repo CentOS-Base.repo.bak
mv /path/to/CentOS6-Base-163.repo CentOS-Base.repo
View CentOS Static IP
The reason I wanted to share this post is configuring static IP on CentOS seems to trouble many centos users. Probably, when you configure static IP, network may not work as you expected, sometimes no internet access, sometimes no IP address on eth0 etc..
First, "watch-out whether it is a CentOS Desktop version or Server version".? because they are runs at different run-levels, where;
- Desktop ver runs on run-level 5
- Server ver runs on run-level 3
Second, watch-out the configuration on
$ vi /etc/sysconfig/network-scripts/ifcfg-eth0
View Linux Static IP
## Configure eth0
#
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
NM_CONTROLLED="yes"
ONBOOT=yes
HWADDR=A4:BA:DB:37:F1:04
TYPE=Ethernet
BOOTPROTO=static
View uninstall_homebrew.sh
#!/bin/sh
# Just copy and paste the lines below (all at once, it won't work line by line!)
# MAKE SURE YOU ARE HAPPY WITH WHAT IT DOES FIRST! THERE IS NO WARRANTY!
function abort {
echo "$1"
exit 1
}
set -e
You can’t perform that action at this time.