Skip to content

Instantly share code, notes, and snippets.

View klinkby's full-sized avatar

Mads Breusch Klinkby klinkby

View GitHub Profile
<!DOCTYPE html>
<html lang="da-DK">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<div>
<textarea id="emails"></textarea>
<button id="doMail"></button>
@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
Function CallbackWrapper {
param (
[string]$callbackScript,
[object]$param,
[int]$order
)
$callback = [ScriptBlock]::Create($callbackScript)
return [PSCustomObject]@{
Result = $callback.InvokeReturnAsIs($param)
Order = $order
@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 / 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 / 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 / restart-dlink-921.sh
Created March 18, 2017 16:32
Shell script for remote reboot the D-Link 921 router
#!/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 / getGroupedViewData.js
Created September 8, 2016 14:16
Extracts aggregated values from a SharePoint view using grouping
function Grouping(title, value, count) {
Object.defineProperties(this, {
title: { value: title },
value: { value: value },
count: { value: count },
groups: { writable: true }
});
}
function getGroupedViewData(listTitle, viewTitle, success, fail) {
@klinkby
klinkby / ManagedWebBrowser.cs
Last active March 14, 2021 13:45
Wraps IE to support lifetime
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using System.Threading;
using SHDocVw;
namespace Capto
{
/// <summary>