Skip to content

Instantly share code, notes, and snippets.

View openssl.py
def roadmr_mini_openssl_dgst():
print("HELLO")
print("let's try to reimplement openssl")
#openssl dgst -sha1 -verify sample-public-key.pub -signature /tmp/signature /tmp/data
pubkeyfile = "keys/sample/sample-public-key.pub"
signaturefile = "keys/sample/signature"
datafile = "keys/sample/data"
pubkey = M2Crypto.EVP.load_key_string_pubkey(
open("keys/sample/sample-public-key.pub", "rb").read())
@Roadmaster
Roadmaster / onepagewebauthn.html
Created Feb 7, 2020
Webauthn demo/test in a single page.
View onepagewebauthn.html
<script type="text/javascript">
// Python to obtain the serverArgJson
/*
from webauthn import WebAuthnMakeCredentialOptions
chor = WebAuthnMakeCredentialOptions(
challenge="ar"*16,
rp_name="Ubuntu One SSO",
# VERY IMPORTANT: the RP_ID must MATCH the URL/HOSTNAME.
View get-snap-with-assertion.sh
#!/bin/bash
SNAP_NAME=lxd
info=$(curl -s https://api.snapcraft.io/v2/snaps/info/$SNAP_NAME -H "Snap-Device-Series: 16")
url=$(echo $info | jq -r '."channel-map"[0]."download"."url"')
snapid=$(echo $info | jq -r '."snap"."snap-id"')
# Download snap
echo "Downloading snap from $url"
@Roadmaster
Roadmaster / bump-crt.sh
Last active May 22, 2019
Bump crt release (with local testing)
View bump-crt.sh
#/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
View gist:c0c660367a3b753afc238c65b1fc825a
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 / oauth-signer.py
Created Apr 10, 2019
calculate oauth signature - for SSO static test validation
View oauth-signer.py
#!/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
@Roadmaster
Roadmaster / samechars.py
Created Apr 4, 2019
detect many characters in a row - 3 approaches
View samechars.py
#!/usr/bin/python3
import re
import timeit
def toomanyinarow1(term, maxreps):
cnt = 1
prev = None
for char in term:
if char == prev:
@Roadmaster
Roadmaster / s
Last active Jun 12, 2020
ssh sig check
View s
The sender needs to do this:
Create a file /tmp/attest with something like "blah", then sign it with:
openssl dgst -sha512 -sign ~/.ssh/id_rsa /tmp/attest > /tmp/attest.sig
then base64-encode the sig and the attest file:
base64 /tmp/attest >/tmp/attest.b64
base64 /tmp/attest.sig >/tmp/attest.sig.b64
@Roadmaster
Roadmaster / gist:08c44bf715feb80017720317bbdfd42f
Created Oct 5, 2018
how to ssh into local lxd containers
View gist:08c44bf715feb80017720317bbdfd42f
# 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
View lxd in the lan
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