Skip to content

Instantly share code, notes, and snippets.

View s3krit's full-sized avatar
😎
😂 🔫

Martin Pugh s3krit

😎
😂 🔫
View GitHub Profile
@s3krit
s3krit / bahn.rb
Last active March 28, 2022 08:20
Little script to pull info about the ICE train you're currently on
# frozen_string_literal: true
require 'json'
require 'net/http'
OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
status_url = 'https://portal.imice.de/api1/rs/status'
trip_url = 'https://portal.imice.de/api1/rs/tripInfo/trip'
begin
status = JSON.parse(Net::HTTP.get(URI(status_url)))
@s3krit
s3krit / paritydb-migration.md
Last active October 21, 2021 18:52
ParityDB-experimental migration

If you are using the EXPERIMENTAL paritydb database for your Polkadot node, when upgrading to Polkadot v0.9.12 from Polkadot v0.9.11, you will need to perform the following manual step after updating your node.

If you are not using the EXPERIMENTAL paritydb (using the --database paritydb-experimental flag) you do not need to take any action and this document can be ignored.

For the below commands, $CHAIN will depend on which chain you are syncing with your node.

  • For Polkadot, $CHAIN is polkadot
  • For Kusama, $CHAIN is ksmcc3
  • For Westend, $CHAIN is westend2

If you do not specify a custom BASE_PATH with --base-path/-d $SOME_LOCATION, execute the following command to move your database to the new location:

The security@parity.io GPG key, which is used to sign releases and Linux packages of polkadot, expired on the the 16th of July 2021 and has subsequently been renewed.

If you make use of our Debian/Ubuntu repositories to install Polkadot, you may need to perform the following steps to fetch the new public GPG key:

# Import the security@parity.io GPG key
gpg --recv-keys --keyserver hkps://keys.mailvelope.com 9D4B2B6EB8F97156D19669A9FF0812D491B96798
gpg --export 9D4B2B6EB8F97156D19669A9FF0812D491B96798 > /usr/share/keyrings/parity.gpg
apt update
# Install the `parity-keyring` package
@s3krit
s3krit / paywall.js
Last active October 28, 2018 19:54
javascript:( function(){ var xmlHttp = new XMLHttpRequest(); xmlHttp.open( "GET", "https://outlineapi.com/parse_article?source_url=" + location.href, false ); xmlHttp.send( null ); res = JSON.parse(xmlHttp.responseText); document.getElementsByTagName('html')[0].innerHTML = res.data.html; } )();
#!/bin/bash
filearg=""
for arg in $@
do
filearg="$filearg -F files[]=@$arg "
done
ret=$(curl -sf $filearg https://file0.s3kr.it/upload)
result=$(echo $ret | egrep -o 'file0.s3kr.it/[a-z0-9]{12}(\.[a-z]+)?' | sort | uniq)
for url in $result
do
#!/bin/bash
pushd /tmp > /dev/null
scrot "$@" scr.png
ret=$(curl -sfX POST -F 'files[]'="@scr.png" "https://file0.s3kr.it/upload")
filehash=$(echo $ret | egrep -o '[a-z0-9]{12}\.[a-z]{3}' | head -n 1)
desturl="https://file0.s3kr.it/${filehash}"
echo $desturl | tr -d '\n' | xclip -selection clipboard
echo $desturl | tr -d '\n' | xclip
rm scr.png
beep
@s3krit
s3krit / frot.sh
Created August 25, 2018 11:28
Takes a screenshot and uploads it to file0, then shoves the URL in your clipboard. Requires scrot and beep.
#!/bin/bash
pushd /tmp
scrot "$@" scr.png
ret=$(curl -sfX POST -F 'files[]'="@scr.png" "https://file0.s3kr.it/upload")
filehash=$(echo $ret | egrep -o '[a-z0-9]{12}\.[a-z]{3}' | head -n 1)
desturl="https://file0.s3kr.it/${filehash}"
echo $desturl | tr -d '\n' | xclip -selection clipboard
echo $desturl | tr -d '\n' | xclip
rm scr.png
beep
@s3krit
s3krit / gbcam.sh
Last active May 19, 2020 20:24
Little script to take images and make them look like Gameboy Camera photos
#!/bin/bash
image=$1
convert -resize 128x112 -filter box -quality 100 $image gbtmp-resize-$image
convert -modulate 100,0,100 gbtmp-resize-$image gbtmp-desat-$image
convert -contrast-stretch 30% gbtmp-desat-$image gbtmp-contrast-$image
convert -ordered-dither o8x8,4 gbtmp-contrast-$image gbtmp-dithered-$image
convert -scale 500% -quality 100 gbtmp-dithered-$image gb-$image.png
rm gbtmp-*-$image
@s3krit
s3krit / lostfm.rb
Created January 28, 2017 21:24
lostfm.rb
require 'dbi'
require 'pry'
require 'cinch'
require 'httpclient'
require 'json'
require 'lastfm'
# Connect to the DB and init
$dbh = DBI.connect('DBI:SQLite3:nickdb')
$dbh.do('CREATE TABLE users(nick varchar(9), lastfm varchar(20));') rescue puts 'Table users already exists'