Skip to content

Instantly share code, notes, and snippets.

^(?<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|$)))?.*)$
@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
@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
@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'
@mrfelton
mrfelton / unlock.sh
Last active July 30, 2019 07:29
Shell script to unlock lnd on system startup
#!/bin/bash
# Do nothing if the WALLET_PASSWORD var is not set.
if [ -z "$PASSWORD" ]; then
echo "[lnd_unlock] Please set PASSWORD in order to unlock wallet automatically."
s6-pause
fi
# output script content for easier debugging.
# set -x
# exit from script if error was raised.
set -e
@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
@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/",
@tyzbit
tyzbit / bootstrap-ubuntu.sh
Last active July 17, 2023 14:03
bootstrap-ubuntu-server
#!/bin/bash
## Edit sudoers (add "NOPASSWD:" to the sudo line before ALL)
## Add optional: true to netplan and apply
## Add Google Kubernetes key
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys B53DC80D13EDEF05
# Install Docker
@bretton
bretton / lightning-maps.md
Last active December 29, 2023 02:59
Visualisers of the Lightning Network (and some other explorers)

A (mostly) visual collection of the Lightning Network

Disclaimer

Network views tend to be the view of the network from a single node, or small selection of nodes. They are not complete views of the network. This is impossible to achieve. Even if many node views were combined, it would still be incomplete.

These network views, or network maps, have been termed 'visualisers' by the LN community.

Screenshots may reflect older visual styles, and are dated accordingly.

@alexbosworth
alexbosworth / inotify-channel-backup.md
Last active March 29, 2024 01:33
Backup channel.backup file using systemd and inotify

LND backup script for channel.backup using inotify

Install inotify

sudo apt install inotify-tools

Create script to watch for changes and copy on change