Skip to content

Instantly share code, notes, and snippets.

View niikoo's full-sized avatar
🐌

Nikolai Ommundsen niikoo

🐌
View GitHub Profile
@niikoo
niikoo / inject-words.js
Created June 24, 2019 18:19
WIP: Add multiple words (csv list) to google docs personal directory
((raw) => {
if(raw == null || raw === '') throw new Error('No data provided');
let data = raw.split(';');
if(data.length === 1) {
data = raw.split(',');
}
if(data.length < 1) {
throw new Error('No words to add...');
}
if(!confirm(`Are you sure you want to add '${data[0]}' and ${data.length - 1} other words?`))
@niikoo
niikoo / JOSM-iD-style.mapcss.css
Last active June 25, 2019 21:31
iD inspired theme for JOSM; with some tweaks for better visibility; based on: https://josm.openstreetmap.de/wiki/Styles/iD
meta {
title: "iD (modified)";
description: "Renders roads, waterways, landuse, and other features like iD. Based on: https://josm.openstreetmap.de/wiki/Styles/iD";
version: "0.7"; /* don't remove the revision variable */
author: "Nikolai Ommundsen & Leif Rasmussen";
link: "https://gist.github.com/niikoo/f55491d1cbe6ae43f24add124d73072f";
min-josm-version: "7193";
}
canvas {
# Get the ID and security principal of the current user account
$myWindowsID=[System.Security.Principal.WindowsIdentity]::GetCurrent()
$myWindowsPrincipal=new-object System.Security.Principal.WindowsPrincipal($myWindowsID)
# Get the security principal for the Administrator role
$adminRole=[System.Security.Principal.WindowsBuiltInRole]::Administrator
# Check to see if we are currently running "as Administrator"
if ($myWindowsPrincipal.IsInRole($adminRole))
{
@niikoo
niikoo / josm-presets-no.xml
Last active August 17, 2019 14:53
JOSM Presets NO
<?xml version="1.0" encoding="UTF-8"?>
<presets xmlns="http://josm.openstreetmap.de/tagging-preset-1.0" shortdescription="JOSM Presets Norway" description="Presets used specifically in Norway" author="niikoo" version="0.1">
<group name="Roads (NO)" no.name="Veier (NO)">
<item name="Driveway" no.name="Innkjørsel / oppkjørsel" type="way">
<key key="highway" value="service" />
<key key="service" value="driveway" />
</item>
</group>
</presets>
@niikoo
niikoo / IMDb Utility Library (API).js
Created January 13, 2020 18:21
Utility library for the Internet Movie Database. Provides an API for grabbing info from IMDb.com
// ==UserScript==
// @name IMDb Utility Library (API)
// @namespace driver8.net
// @version 0.1.1
// @description Utility library for the Internet Movie Database. Provides an API for grabbing info from IMDb.com
// @author driver8
// @match *://*.imdb.com/*
// @grant GM_xmlhttpRequest
// @connect imdb.com
// ==/UserScript==
@niikoo
niikoo / GM_XHR.js
Created August 13, 2020 22:08 — forked from monperrus/GM_XHR.js
allows using all Jquery AJAX methods in Greasemonkey
// allows using all Jquery AJAX methods in Greasemonkey
// inspired from http://ryangreenberg.com/archives/2010/03/greasemonkey_jquery.php
// works with JQuery 1.5
// (c) 2011 Martin Monperrus
// (c) 2010 Ryan Greenberg
//
// Usage:
// $.ajax({
// url: '/p/',
// xhr: function(){return new GM_XHR();},
@niikoo
niikoo / sharepoint-up-actionbtn.user.js
Last active June 28, 2021 17:09
Sharepoint: Add an action button to go 'Up' one folder in the file browser
// ==UserScript==
// @name Sharepoint: Go Up One Folder Action Button
// @namespace https://github.com/niikoo
// @version 0.4.1
// @description Add an action button to go 'Up' one folder in the file browser
// @author niikoo
// @homepage https://gist.github.com/niikoo/a49658ed816b35522831031f6a80992b
// @match https://*.sharepoint.com/*
// @updateURL https://gist.github.com/niikoo/a49658ed816b35522831031f6a80992b/raw/sharepoint-up-actionbtn.user.js
// @downloadURL https://gist.github.com/niikoo/a49658ed816b35522831031f6a80992b/raw/sharepoint-up-actionbtn.user.js
@niikoo
niikoo / nvram-clean.sh
Last active September 8, 2020 21:38
OpenWRT nvram-clean.sh for Linksys wrt54gl
# OpenWRT nvram-clean.sh for Linksys wrt54gl
#
# Usage: https://openwrt.org/toh/linksys/wrt54g
#
# Source: https://web.archive.org/web/20140326172212/http://downloads.openwrt.org/people/nbd/nvram-clean.sh
# Version: 1.0
empty() {
case "$1" in
"") return 0 ;;
@niikoo
niikoo / sign-powershell-script.ps1
Last active October 9, 2020 22:20 — forked from actaneon/signPowershell.ps1
Sign Powershell Script
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing")
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
$dialog = New-Object -TypeName System.Windows.Forms.OpenFileDialog
$dialog.AddExtension = $true
$dialog.Filter = 'PowerShell-Script (*.ps1)|*.ps1'
$dialog.Multiselect = $true
$dialog.FilterIndex = 0
$dialog.InitialDirectory = [System.IO.Path]::GetFullPath([System.IO.Path]::Combine($PSScriptRoot, ".."))
public static class EnumExtensions
{
public static string GetEnumMemberValue<T>(this T type)
where T : Enum
{
var enumType = typeof(T);
var name = Enum.GetName(enumType, type);
var enumMemberAttribute = ((EnumMemberAttribute[])enumType.GetField(name).GetCustomAttributes(typeof(EnumMemberAttribute), true)).Single();
return enumMemberAttribute.Value;
}