Skip to content

Instantly share code, notes, and snippets.

View lujiacn's full-sized avatar

JL lujiacn

  • earth
  • earth
View GitHub Profile
sudo date -s "$(wget -S "http://www.google.com/" 2>&1 | grep -E '^[[:space:]]*[dD]ate:' | sed 's/^[[:space:]]*[dD]ate:[[:space:]]*//' | head -1l | awk '{print $1, $3, $2, $5 ,"GMT", $4 }' | sed 's/,//')"
! [remote rejected] master -> master (pre-receive hook declined)
solution:
git pull --rebase
refer to http://stackoverflow.com/questions/7986139/git-error-when-trying-to-push-pre-receive-hook-declined
@lujiacn
lujiacn / gist:8d8bddb699d4103d296bd68936ad9c37
Created July 30, 2016 08:23
generate 64 character key
date +%s | sha256sum | base64 | head -c 64 ; echo
@lujiacn
lujiacn / start-rserve.sh
Last active August 9, 2016 02:51 — forked from erochest/start-rserve.sh
A simple shell script to start Rserve.
#without output
R -e 'library(Rserve); Rserve(args="--vanilla")' 2>&1 > /dev/null
@lujiacn
lujiacn / ubuntu lid close
Created September 5, 2016 02:42
make lid close do nothing
refer: http://askubuntu.com/questions/15520/how-can-i-tell-ubuntu-to-do-nothing-when-i-close-my-laptop-lid
accepted
For 13.10 - 16.04:
To make Ubuntu do nothing when laptop lid is closed:
Open the /etc/systemd/logind.conf file in a text editor as root, for example,
sudo -H gedit /etc/systemd/logind.conf
Add a line HandleLidSwitch=ignore (make sure it's not commented out!),
:%!python -m json.tool
@lujiacn
lujiacn / gist:cc7f0115ec9db8c3ac6c94c6c6e3e5ea
Created October 16, 2016 12:01
show disk partition info
sudo lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL
@lujiacn
lujiacn / current-dir-in-iterm-tab-title.sh
Created October 18, 2016 10:05 — forked from phette23/current-dir-in-iterm-tab-title.sh
Set the iTerm tab title to the current directory, not full path.
# put this in your .bash_profile
if [ $ITERM_SESSION_ID ]; then
export PROMPT_COMMAND='echo -ne "\033];${PWD##*/}\007"; ':"$PROMPT_COMMAND";
fi
# Piece-by-Piece Explanation:
# the if condition makes sure we only screw with $PROMPT_COMMAND if we're in an iTerm environment
# iTerm happens to give each session a unique $ITERM_SESSION_ID we can use, $ITERM_PROFILE is an option too
# the $PROMPT_COMMAND environment variable is executed every time a command is run
# see: ss64.com/bash/syntax-prompt.html
@lujiacn
lujiacn / sendMail.go
Created January 29, 2017 11:58 — forked from andelf/sendMail.go
golang send mail net/smtp SMTP
package main
import (
"log"
"net/mail"
"encoding/base64"
"net/smtp"
"fmt"
"strings"
@lujiacn
lujiacn / Monaco for Powerline.md
Created October 25, 2017 15:03 — forked from ymjing/Monaco for Powerline.md
Powerline-patched Monaco for Windows and OSX

Powerline-patched Monaco for Windows and OSX

This font is manually patched with Fontforge. It includes the glyphs from DejaVu Sans Mono for Powerline.

I recommend DirectWrite-patched VIM builds. I'm using KaoriYa's build (http://www.kaoriya.net/software/vim/)

Usage

Add the following lines to your .vimrc/_vimrc: