Skip to content

Instantly share code, notes, and snippets.

Xiuyu Li nickleefly

Block or report user

Report or block nickleefly

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
@nickleefly
nickleefly / Freenode IRC.md
Created May 21, 2019 — forked from yeyewangwang/Freenode IRC.md
Freenode Nickserv Commands
View Freenode IRC.md

Freenode IRC

Connect

/server chat.freenode.net

Nick

@nickleefly
nickleefly / README.md
Created Dec 20, 2017 — forked from jamesramsay/README.md
Gmail: delete old emails automatically
View README.md

Gmail: delete old emails automatically

Automatically deletes old emails that match the specified label.

Get started

  • Create a new Google Apps Script at https://script.google.com
  • Overwrite the placeholder with the javascript below
  • Update the following constants:
    • LABEL_TO_DELETE: the label that should be have old messages deleted
@nickleefly
nickleefly / npx-osx.md
Created Dec 10, 2017 — forked from tamzinblake/npx-osx.md
How to get npx shell auto fallback working on OSX bash
View npx-osx.md

OSX ships with bash 3 by default, but you need bash 4 to use npx shell auto fallback. Using homebrew:

(instructions borrowed from https://github.com/Homebrew/homebrew-command-not-found)

brew update && brew install bash
# Add the new shell to the list of allowed shells
sudo bash -c 'echo /usr/local/bin/bash >> /etc/shells'
# Change to the new shell
chsh -s /usr/local/bin/bash
@nickleefly
nickleefly / Ansible-Vault how-to.md
Created Sep 7, 2017 — forked from tristanfisher/Ansible-Vault how-to.md
A short tutorial on how to use Vault in your Ansible workflow. Ansible-vault allows you to more safely store sensitive information in a source code repository or on disk.
View Ansible-Vault how-to.md

##Working with ansible-vault

I've been using a lot of Ansible lately and while almost everything has been great, finding a clean way to implement ansible-vault wasn't immediately apparent.

What I decided on was the following: put your secret information into a vars file, reference that vars file from your task, and encrypt the whole vars file using ansible-vault encrypt.

Let's use an example: You're writing an Ansible role and want to encrypt the spoiler for the movie Aliens.

@nickleefly
nickleefly / prime-generator.js
Last active Jan 12, 2016 — forked from trevnorris/prime-generator.js
fastest js prime generator been able to get http://jsperf.com/123123123456
View prime-generator.js
// Thanks to @isntitvacant (https://github.com/chrisdickinson) for optimizing the
// bit shift performance tweaks.
var SB = require('buffer').SlowBuffer;
var ITER = 2e4;
var SIZE = 1e3;
function genPrimes(max) {
var primes = new Array();
var len = (max >>> 3) + 1;
View install-iojs-nightly.sh
#!/bin/bash
# Usage:
# sudo ./install-iojs-nightly.sh
# or for next-nightly:
# sudo ./install-iojs-nightly.sh next
type=nightly
if [ "X$1" == "Xnext" ]; then
type=next-nightly
@nickleefly
nickleefly / GIF-Screencast-OSX.md
Last active Aug 29, 2015 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF
View GIF-Screencast-OSX.md

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@nickleefly
nickleefly / .zshrc
Last active Aug 29, 2015 — forked from SlexAxton/.zshrc
gif workflow
View .zshrc
gifify() {
if [[ -n "$1" ]]; then
if [[ $2 == '--good' ]]; then
ffmpeg -i $1 -r 10 -vcodec png out-static-%05d.png
time convert -verbose +dither -layers Optimize -resize 600x600\> out-static*.png GIF:- | gifsicle --colors 128 --delay=5 --loop --optimize=3 --multifile - > $1.gif
rm out-static*.png
else
ffmpeg -i $1 -s 600x400 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=3 > $1.gif
fi
else
View branch-by-date.md
git branch -vv --color=always | while read; do echo -e $(git log -1 --format=%ci $(echo "_$REPLY" | awk '{print $2}' | perl -pe 's/\e\[?.*?[\@-~]//g') 2> /dev/null || git log -1 --format=%ci)" $REPLY"; done | sort -r | cut -d ' ' -f -1,4-

git for-each-ref --format='%(committerdate:iso8601) %(committerdate:relative) %(refname)' --sort -committerdate
git for-each-ref --format='%(committerdate:iso8601) %(committerdate:relative) %(refname)' --sort -committerdate refs/heads/
git for-each-ref --format='%(committerdate:short),%(authorname),%(refname:short)' --sort=committerdate refs/heads/ | column -t -s ','

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
for branch in `git branch -l | grep -v '*'`;do echo -e `git show --format="%ci %cr" $branch | head -n 1` \\t$branch; done | sort -r
View dotslashtaskdotjs.markdown

why ./task.js?

One word: task automation. It's basically zero effort and you can use the ./task.js package manager to handle any repetitive tasks. You can use ./task.js to automate everything with minimum effort.

./task.js provides the structure, order, and authority that you as a developer so desperately crave. ./task.js will also take responsibility for your actions if you need it to. It's what everybody is using now. ./task.js is the new hotness. It's all about ./task.js now, just like that.

This is compared to npm run/bash scripts, which are:

You can’t perform that action at this time.