Skip to content

Instantly share code, notes, and snippets.

View prasmussen's full-sized avatar

Petter Rasmussen prasmussen

View GitHub Profile
@prasmussen
prasmussen / code-sandbox.conf
Last active December 30, 2020 21:48
Code sandbox tutorial
server {
listen 8000;
server_name _;
root /home/glot/www;
index index.html;
location / {
try_files $uri $uri/ =404;
net.ipv4.ip_forward=1
net.ipv6.conf.default.forwarding=1
net.ipv6.conf.6rdtun.forwarding=1
net.ipv6.conf.all.forwarding=1
@prasmussen
prasmussen / decrypt.js
Last active January 8, 2019 20:32
Decrypt blockstack encryptedPortalKey
var triplesec = require('triplesec');
var encryptedPortalKey = new Buffer("<encryptedPortalKey>", "hex");
var password = new Buffer("<password>");
triplesec.decrypt({key: password, data: encryptedPortalKey}, function(err, plaintext) {
if (err) {
console.log(err);
} else {
console.log("Your backup phrase:");
Verifying that "prasmussen.id" is my Blockstack ID. https://onename.com/prasmussen
@prasmussen
prasmussen / zopim.js
Created February 12, 2016 15:31
Tampermonkey scripts
// ==UserScript==
// @name Disable zopim livechat
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match *://*/*
// @grant none
// ==/UserScript==
/* jshint -W097 */
data DesignData = DesignData {
getName :: Text,
getAge :: Int
} deriving Show
instance FromJSON DesignData where
parseJSON (Object obj) =
DesignData <$>
obj .: "name" <*>
obj .: "age"
@prasmussen
prasmussen / gist:7fda8d5bcce65fd7d186
Last active March 20, 2024 23:18
chrome-cli execute loop
#!/bin/bash
for n in $(chrome-cli list tabs | awk '{print $1}' | sed -e 's/\[//' | sed -e 's/\]//'); do
chrome-cli execute '$("#run-code-button").click()' -t $n > /dev/null
done
postApiR :: Handler ()
postApiR = do
liftIO $ putStrLn "init"
payload <- requireJsonBody :: Handler Payload
now <- liftIO getCurrentTime
_ <- runDB $ insert $ Weather now (temperature payload) (humidity payload)
sendResponseStatus status201 ("CREATED" :: Text)
@prasmussen
prasmussen / gist:10497516
Last active August 29, 2015 13:59
tmux.conf
# Set ctrl-a as prefix
set -g prefix C-a
unbind C-b
# ctrl-a passthrough by sending ctrl-a 2 times
bind C-a send-prefix
# Less delay
set -sg escape-time 1
WAN addr: 81.167.4.214
eth0 = LAN
$ ipv6calc --action 6rd_local_prefix --6rd_prefix 2a01:79c::/30 --6rd_relay_prefix 213.167.115.92/0 81.167.4.214
2a01:79d:469c:1358::/62
sudo ip tunnel add 6rdtun mode sit local 81.167.4.214 ttl 64
sudo ip tunnel 6rd dev 6rdtun 6rd-prefix 2a01:79c::/30
sudo ip link set 6rdtun up