Skip to content

Instantly share code, notes, and snippets.

View Roadmaster's full-sized avatar

Roadmaster Roadmaster

  • Montreal, QC, Canada
  • 20:25 (UTC -04:00)
View GitHub Profile
env PROMETHEUS=/usr/bin/prometheus
env CONFIG=/etc/prometheus/prometheus.yml
env USER=prometheus
env GROUP=prometheus
env DEFAULTS=/etc/default/prometheus
env RUNDIR=/var/run/prometheus
env PID_FILE=/var/run/prometheus/prometheus.pid
pre-start script
[ -e $DEFAULTS ] && . $DEFAULTS
@Roadmaster
Roadmaster / snap-lxc.sh
Created October 27, 2017 21:21
snap-lxc.sh
#!/bin/bash
# Create lxc profile that allows using snaps in the container
NAME=snap
lxc profile create $NAME &> /dev/null || true
cat << EOF | lxc profile edit $NAME
name: $NAME
description: Set up snaposity
config:
security.nesting: "true"
user.vendor-data: |
#!/usr/bin/env python
import pygame
from random import randint, choice
def main():
pygame.init()
screen = pygame.display.set_mode((0, 0), pygame.FULLSCREEN)
info = pygame.display.Info()
@Roadmaster
Roadmaster / gist:6a4814ee253d055475e4b2cc64e688e1
Created January 31, 2018 23:32
Fix for kuard's build.sh script because npm/node/etc is suck a brainfuckery
diff --git a/build/build.sh b/build/build.sh
index 485c6ca..df82658 100755
--- a/build/build.sh
+++ b/build/build.sh
@@ -45,6 +45,8 @@ export GOARCH="${ARCH}"
(
cd client
npm install --loglevel=error
+ chmod 755 ./node_modules/webpack/bin/webpack.js
+
https://discuss.linuxcontainers.org/t/lxd-netplan-static-ips-in-same-subnet-how-to/1074/7
$ lxc profile show lan
config: {}
description: ""
devices:
br0:
nictype: bridged
parent: br0
type: nic
@Roadmaster
Roadmaster / gist:08c44bf715feb80017720317bbdfd42f
Created October 5, 2018 20:05
how to ssh into local lxd containers
# snippet for .ssh/config
Host *.lxd
#User ubuntu
#StrictHostKeyChecking no
#UserKnownHostsFile /dev/null
ProxyCommand nc $(lxc list --format csv -c s4 $(echo %h | sed "s/\.lxd//g") %h | python3 -c "import csv,sys; print([ip for ip in [e.split('\n') for s,e in list(csv.reader(sys.stdin)) if s == 'RUNNING'][0] if
'eth' in ip][0].split(' ')[0])") %p
@Roadmaster
Roadmaster / samechars.py
Created April 4, 2019 15:36
detect many characters in a row - 3 approaches
#!/usr/bin/python3
import re
import timeit
def toomanyinarow1(term, maxreps):
cnt = 1
prev = None
for char in term:
if char == prev:
@Roadmaster
Roadmaster / oauth-signer.py
Created April 10, 2019 19:34
calculate oauth signature - for SSO static test validation
#!/usr/bin/env fades
from pprint import pprint
from urllib.parse import urlencode
from oauthlib import oauth1 # fades
# client_key is the openid_identifier from the account
# client_secret is the oauth_secret from the account
# resource_owner_key is the key from the token in account.token_set.create
# resource_owner_secret is the secret from the above
# timestamp and nonce should be the fixed values noted in the existing test
Small format (no 4k monstrosities thanks):
youtube-dl -f "[height <= 1024]" -a bru.txt
Good quality:
youtube-dl -f "bestvideo+bestaudio[ext=m4a]"
@Roadmaster
Roadmaster / bump-crt.sh
Last active May 22, 2019 22:15
Bump crt release (with local testing)
#/bin/bash
CRT_BRANCH=/src/click-reviewers-tools/review-tools # git branch
SCA_BRANCHES=/src/software-center-agent
WANTED_RELEASE=$1
NEW_BRANCH=sca-crt-$WANTED_RELEASE
if [ -z $WANTED_RELEASE ]; then
echo "Didn't indicate a wanted release"
exit 1
fi