Skip to content

Instantly share code, notes, and snippets.

View z1nkum's full-sized avatar

Dmitry S. Vlasov z1nkum

View GitHub Profile
mkdir /root/.lnd
apt-get update
apt-get install docker docker-compose git
cd /opt; git clone -b elastoo-lnd --single-branch https://github.com/z1nkum/lnd.git
cd /opt/lnd/docker
curl ifconfig.io # get EXT ip for next step
vim .env
NETWORK=testnet
RPCUSER=olololo
@z1nkum
z1nkum / make_my_disks_snapshots.sh
Last active January 14, 2018 14:35
cronjob backup all disks for Google Cloud Instances
#!/bin/sh
# 1) crontab -l: 15 1 * * * /root/make_my_disks_snapshots.sh
# 2) Add service account snapshots-rw@[project-id].iam.gserviceaccount.com with Compute Storage Admin role attached
# 3) Set this account to instance
S_DATE=`date +"%Y%m%d-%H%M%S"`
S_NAME=`hostname`
ZONE=`curl -s -m 10 "http://metadata.google.internal/computeMetadata/v1/instance/zone" -H "Metadata-Flavor: Google" | grep -Po '[^/]+$'`
@z1nkum
z1nkum / graphite-grafana-statsd-inside-docker.md
Last active May 10, 2023 08:43
Run graphite-stack inside docker via docker-compose
# getenforce
Disabled

Also we need docker, docker-compose, certbot (if you need LetEncrypt)

mkdir -p /opt/graphite/conf /opt/graphite/data /opt/graphite/storage /opt/statsd /opt/grafana/log

/etc/docker/compose/graphite/docker-compose.yml

#!/usr/bin/env python
import argparse
import logging
from sys import stdout
logging.basicConfig(stream=stdout,
level=logging.ERROR,
format='%(asctime)s\t%(process)d\t%(levelname)s\t%(message)s')
{
"name": "",
"version": "0.0.1",
"description": "",
"moduleType": [
"amd"
],
"authors": [
"Dmitry S. Vlasov"
],
/*
Redis Ratelimit trait
*/
trait RateLimitRedis
{
protected $redis;
@z1nkum
z1nkum / ClientUniq.php
Last active October 23, 2015 15:47
Class support unique param (id)
abstract class ObjectWithUniqueID {
public $id;
public static $registry = array();
public function getObjectById( $id ) {
if ( array_key_exists( $id, static::$registry ) ) {
return static::$registry[$id];
} else return null;
}
@z1nkum
z1nkum / gist:47523d3f9b0f754ebaaa
Created May 31, 2015 18:45
OpenWRT dansguardian privproxy
opkg update
opkg install privproxy
uci add firewall redirect
uci set firewall.@redirect[-1]._name=dansguardian
uci set firewall.@redirect[-1].src=lan
uci set firewall.@redirect[-1].proto=tcp
uci set firewall.@redirect[-1].dest_port=8080
uci set firewall.@redirect[-1].src_dport=80
uci set firewall.@redirect[-1].src_dip='! 192.168.111.1'
uci set firewall.@redirect[-1].dest_ip=192.168.111.1