Skip to content

Instantly share code, notes, and snippets.

View klinkby's full-sized avatar

Mads Breusch Klinkby klinkby

View GitHub Profile
### Keybase proof
I hereby claim:
* I am klinkby on github.
* I am klinkby (https://keybase.io/klinkby) on keybase.
* I have a public key whose fingerprint is F9D7 19F6 A0A0 0278 FFB3 3AF0 BC98 741A 9997 9D59
To claim this, I am signing this object:
@klinkby
klinkby / querystring.js
Created February 23, 2016 10:10
Deserialize and serialize a query string
function QueryString(qs) {
var re = /([^&=]+)=([^&]*)/g,
m;
while (m = re.exec((qs || location.search).substring(1))) { // skip the question mark
this[decodeURIComponent(m[1])] = decodeURIComponent(m[2]);
}
}
QueryString.prototype.toString = function () {
var ser = "?";
@klinkby
klinkby / gist:22b417e0f1f80096a3c1
Created March 11, 2016 08:22
Query SharePoint Announcemements in this site collection that are not expired
(ContentTypeId:0x0104*) (contentclass:STS_ListItem) (Path:{SiteCollection.URL}) NOT (ExpirationTime<{Today})
OOB on O365
#
# This is a VCL file for Varnish used with @TryGhost blog.
# It rewrites Wordpress-style /yyyy/mm/dd/slug urls
# to /slug and /rss20.xml to Ghost's /rss/
# Adds 60 mins cachability to pages, adds AMP Project CSP header and a few other
# security headers giving the site an A+ on https://securityheaders.io/
# Marker to tell the VCL compiler that this VCL has been adapted to the
# new 4.0 format.
#!/bin/bash
sudo docker pull nginx:alpine
sudo docker pull jwilder/docker-gen
sudo docker pull jrcs/letsencrypt-nginx-proxy-companion
sudo docker pull zzrot/alpine-ghost
wget https://raw.githubusercontent.com/jwilder/nginx-proxy/master/nginx.tmpl
sudo cp nginx.tmpl /volumes/proxy/templates/
@klinkby
klinkby / restart-dlink-921.sh
Created March 18, 2017 16:32
Shell script for remote reboot the D-Link 921 router
@klinkby
klinkby / textbox-clientaddin.js
Last active August 29, 2017 12:02
NAV client control with a simple multiline text box
/**
* NAV client control with a simple multiline text box
* Exposes the following methods:
* GetText() : string
* SetText(string)
* GetReadOnly() : boolean
* SetReadOnly(boolean)
*
* And the following events:
* Blur
@klinkby
klinkby / perf-coll.js
Created September 28, 2017 07:49
Collect key performance metrics, dump in document then reload page for another run.
(function () {
"use strict";
var t = performance.timing,
t1 = t.navigationStart,
arr = [t.responseEnd - t1, t.domContentLoadedEventStart - t1, t.loadEventEnd - t1],
storage = sessionStorage,
storageKey = "perf-coll",
coll = JSON.parse(storage.getItem(storageKey) || "[]"),
serialized;
coll.push(arr);
@klinkby
klinkby / Get-Spreadsheet.ps1
Last active June 3, 2019 17:35
Powershell script to read Excel spreadsheet contents
function Get-Spreadsheet {
param(
[Parameter(Mandatory = $true)]
[ValidateScript({ Test-Path $_ -PathType Leaf })]
[string]$Path
)
try {
[DocumentFormat.OpenXml.Packaging.SpreadsheetDocument] | Out-Null
}
catch {
@klinkby
klinkby / boinc-rosetta.sh
Created April 11, 2020 19:58
Shell script for running rosetta on a plain
sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get install boinc-client
sudo /etc/init.d/boinc-client restart
boinccmd --project_attach https://boinc.bakerlab.org/rosetta/ {your-weak-key-here}
boinccmd --set_run_mode always
boinccmd --set_network_mode always
boinccmd --get_simple_gui_info