Instantly share code, notes, and snippets.

View disconnect-dc.sh
docker network disconnect "${PWD##*/}_shared" roach-4
docker network disconnect "${PWD##*/}_shared" roach-5
View golang_job_queue.md
View git-tag-delete-local-and-remote.sh
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName
View git-submodule-fetch
#!/bin/bash
set -e
set -u
if [ $# -eq 0 ]; then
git submodule -q foreach 'echo $name' | xargs -n 1 -P 10 git-submodule-fetch
else
while [ $# -gt 0 ]; do
(cd $1; git fetch -q || echo "Failed to fetch $1">&2)
View curl.md

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

View intel-edison.md

Updating firmware

First download the firmware in the Intel website.

Then open the mounted disk and remove everything inside. Unzip the content of the download in the drive then access the Edison true screen (see the tutorial bellow).

And run the command:

$ reboot ota
View .bash_aliases
### Directory
alias ll="ls -lv"
alias lla="ls -alv"
alias glg="git log --pretty='format:%Cgreen%h%Creset %an - %s' --graph"
alias gl="git log --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen %cr %an%Creset'"
alias gs="git status"
alias gd="git diff"
# add
alias ga="git add"
View graceful.go
package main
import (
"context"
"log"
"net/http"
"os"
"os/signal"
"time"
)
View gist:f4b3361547f82e1d45128b3eadab746d
// this will find all files ending with _test.js and run them with Mocha. Put this in your package.json
"scripts": {
"test": "find ./tests -name '*_test.js' | xargs mocha -R spec"
},
View destructuring.js
// === Arrays
var [a, b] = [1, 2];
console.log(a, b);
//=> 1 2
// Use from functions, only select from pattern
var foo = () => [1, 2, 3];