Skip to content

Instantly share code, notes, and snippets.

View Oisann's full-sized avatar

Jonas Myhr Refseth Oisann

View GitHub Profile
function venv() {
if [ ! -f ./.venv/bin/activate ]; then
echo 'ERROR: No virtual environment found.'
return
fi
if [ -v $VIRTUAL_ENV ]; then
source ./.venv/bin/activate
else
deactivate
fi
-- strict tables
CREATE TABLE foo (name TEXT, age INT) STRICT;
-- Enable Write ahead log (just run this on the db file once and it is enabled)
PRAGMA journal_mode=WAL;
-- Lower synchronous level (with WAL, you should set it to 1. Default is 2)
PRAGMA synchronous=1;
@Oisann
Oisann / sshtmp.sh
Last active May 1, 2024 21:09
Connect to ssh servers with temporary keys (for public servers like terminal.shop)
#!/bin/zsh
REMOTE_SERVER=$1
REPLACEMENT="anon@ubuntu"
LOGIN="$USER@$HOSTNAME"
WD=`mktemp -d`
pushd $WD > /dev/null
ssh-keygen -t rsa -b 4096 -q -f "$WD/id_rsa" -N ""
sed -i -e "s/$LOGIN/$REPLACEMENT/g" "$WD/id_rsa.pub"
chmod 400 "$WD/id_rsa"
@Oisann
Oisann / ios-profile-certs.sh
Created November 9, 2022 16:25 — forked from sehrgut/ios-profile-certs.sh
Lists certificates permitted by an iOS provisioning profile
#!/bin/bash
readonly MODE_INFO=0
readonly MODE_VERBOSE=1
readonly MODE_EXTRACT=2
PLISTBUDDY=/usr/libexec/PlistBuddy
RUNMODE=$MODE_BASIC
TMP=`mktemp -t ios-profile-certs`
@Oisann
Oisann / no-youtube-ambilight.user.js
Last active October 18, 2022 20:50
Click on the Raw button below and Tampermonkey should automatically pick it up. Just press install.
// ==UserScript==
// @name No YT Ambilight
// @namespace https://oisann.net/
// @version 0.3
// @description Remove YouTube Cinematics Effect.
// @author Oisann
// @match https://www.youtube.com/watch*
// @icon https://www.google.com/s2/favicons?sz=64&domain=youtube.com
// @grant none
// ==/UserScript==
@Oisann
Oisann / post.sh
Last active March 5, 2022 01:44
Requires curl and jq to be installed.
#/bin/bash
POST_NUMBER=$1
if [ -z "$POST_NUMBER" ]
then
POST_NUMBER="0655"
fi
echo "Post nummer: $POST_NUMBER"
{"v":"5.5.7","meta":{"g":"LottieFiles AE 0.1.21","a":"","k":"","d":"","tc":"none"},"fr":60,"ip":0,"op":150,"w":280,"h":144,"nm":"17MAI-group","ddd":1,"assets":[{"id":"comp_0","layers":[{"ddd":0,"ind":1,"ty":0,"nm":"▽ wristL","parent":7,"refId":"comp_1","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.167],"y":[0.167]},"t":0,"s":[0]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.333],"y":[0]},"t":32,"s":[22]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.167],"y":[0.167]},"t":70,"s":[0]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.333],"y":[0]},"t":110,"s":[22]},{"t":150,"s":[0]}],"ix":10},"p":{"a":0,"k":[-11.785,15.334,0],"ix":2},"a":{"a":0,"k":[48.2,21.736,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"w":60,"h":39,"ip":0,"op":152,"st":0,"bm":0},{"ddd":0,"ind":2,"ty":0,"nm":"▽ flag 3","parent":1,"refId":"comp_3","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[-26.721,-41.593,0],"ix":2},"a":{"a":0,"k":[39,55,0],"ix":1},"s":{"a":0
@Oisann
Oisann / Corefile
Created August 19, 2020 08:37
My current CoreDNS config file.
. {
cache
forward . 127.0.0.1:5301 127.0.0.1:5302
}
.:5301 {
forward . 8.8.8.8 8.8.4.4 {
tls_servername dns.google
}
}
time = 1
if time == 1:
print("time is 1")
elif time == 3:
print("time is 3")
else:
print("time is not 1 or 3")