Skip to content

Instantly share code, notes, and snippets.

@CristinaSolana
CristinaSolana / gist:1885435
Created February 22, 2012 14:56
Keeping a fork up to date

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@mattetti
mattetti / gist:3798173
Last active April 16, 2023 03:09
async fetching of urls using goroutines and channels
package main
import (
"fmt"
"net/http"
"time"
)
var urls = []string{
"https://splice.com/",
@Dirrk
Dirrk / daemontools-centos.sh
Last active February 8, 2019 12:57
Install daemon tools to centos
#!/bin/bash
# Install daemon tools
if [ "$UID" -ne 0 ]
then echo "Please run as root"
exit
fi
if [ ! -e /usr/bin/gcc ] || [ ! -e /usr/bin/make ]; then
echo gcc or make not installed going to install dev tools in 5 seconds press ^C to exit
sleep 6
yum -y groupinstall 'Development Tools'
@paladini
paladini / The HEX and RGB code for the Bitcoin orange color
Last active January 25, 2021 23:22
The HEX / RGB code for the orange color from Bitcoin logo
Do you want know what's the orange color from Bitcoin logo? Here's the colours:
Hexadecimal:
#FF9900
RGB
(255,153,0)
Any suggestions are welcome!
Fonts: http://www.color-hex.com/color/ff9900 and https://bitcointalk.org/index.php?topic=224522.0
@bastman
bastman / docker-cleanup-resources.md
Created March 31, 2016 05:55
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@qizhihere
qizhihere / docker-entrypoint-example.sh
Created June 28, 2016 14:38
Run a process in a docker container with specific uid and gid. Take dropbox for example.
#!/usr/bin/env sh
has_gid () {
cut -d: -f1,4 /etc/passwd | grep -q "^${1}:${2}" || return 1
}
# example: ensure_user btsync 1000 1000
ensure_user () {
local user=$1
local uid=$2
@acamino
acamino / README.md
Last active May 1, 2024 06:25
Shortcuts to Improve Your Bash & Zsh Productivity

Shortcut — Action

  • CTRL + A — Move to the beginning of the line
  • CTRL + E — Move to the end of the line
  • CTRL + [left arrow] — Move one word backward (on some systems this is ALT + B)
  • CTRL + [right arrow] — Move one word forward (on some systems this is ALT + F)
  • CTRL + U — (bash) Clear the characters on the line before the current cursor position
  • CTRL + U —(zsh) If you're using the zsh, this will clear the entire line
  • CTRL + K — Clear the characters on the line after the current cursor position
  • ESC + [backspace] — Delete the word in front of the cursor
^(?<timestamp>\w+\s+\d+,\s+\d+\s+\d+:\d+:\d+\.\d+)[^\]\n]*\]\s+(?<loglevel>\w+) - (?<full_message>(?:(?:Request: \[(?<request_ip>[^:]+).*Token \((?<username>[^)]+))?(?:\[?(?<status_source>[\w\s]+)((\]|: )))?(?:Adding (?<session_number>\d) sessions\.)?(?:Found session GUID of (?<session_guid>[^\s]+))??(?:Session (?<playback_session_guid>[^\s]+) \((?<playback_session_number>[^\)]+)\) is (?<placyback_session_status>\w+))?(?:using profile (?<transcode_profile>.*))?(?:.*\/transcode\/session\/(?<transcode_session_guid>[^\/]+))?(?:It took (?<time_taken>[\d\.]+) sec to (?<action_taken>.*))?)?(?:Content-Length of (?<file_path>.*\/(?<file_name>[\w\s]+\.(avi|mp4|mkv|m4v|wmv|mpg|mpeg|divx))(\s|$)))?.*)$
@knadh
knadh / zsh-elapsed-time.md
Last active April 20, 2024 06:35
Elapsed and execution time for commands in ZSH

Elapsed and execution time display for commands in ZSH

Append this to your ~/.zshrc file.

function preexec() {
 timer=$(($(date +%s%0N)/1000000))
@bretton
bretton / monitor-lnd-balances.md
Last active January 24, 2018 21:33
monitor lnd wallet and channel balances

Short script to monitor walletbalance and channelbalance for LND, and log to csv file for later graphing. You need a working LND, and jq installed.

first setup by editing balances.txt and add a header line

date,walletbalance,channelbalance

add the following script, edit lndbalances.sh

#!/bin/bash