Skip to content

Instantly share code, notes, and snippets.

View jhauge's full-sized avatar

Jesper Hauge jhauge

View GitHub Profile
@jhauge
jhauge / function-app-azure-pipeline.yml
Created August 5, 2020 06:38
Example pipeline definition for Azure Function App
# .NET Core Function App to Windows on Azure
# Build a .NET Core function app and deploy it to Azure as a Windows function App.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/en-us/azure/devops/pipelines/languages/dotnet-core
trigger:
- master
variables:
# Azure Resource Manager connection created during pipeline creation
@jhauge
jhauge / getCovidDeaths.ps1
Created March 27, 2020 18:00
Powershell script to get Covid data from github.
# This script gets the death numbers of yesterday and the day before that
# from the Johns Hopkins dataset in github and calculates the number of deaths
# for the last day in the third column.
# Set up SQL provider
$provider = (New-Object System.Data.OleDb.OleDbEnumerator).GetElements() `
| Where-Object { $_.SOURCES_NAME -like "Microsoft.ACE.OLEDB.*" }
if ($provider -is [system.array]) {
$provider = $provider[0].SOURCES_NAME
}
{
"globals": {
"alwaysShowTabs": true,
"defaultProfile": "{720627e5-2bb1-4517-b092-f7def53a44b8}",
"initialCols": 150,
"initialRows": 65,
"keybindings": [{
"command": "closeTab",
"keys": [
"ctrl+w"
# Create and enter directory
function global:CreateAndChangeTo-Directory () {
md $args[0]; cd $args[0]
}
Set-Alias mcd CreateAndChangeTo-Directory
# Edit hosts file
function global:Edit-Hosts () {
start-process -verb runAs "notepad" -argumentlist "C:\Windows\System32\drivers\etc\hosts"
}
@jhauge
jhauge / HomeController.cs
Created August 7, 2018 13:45
ASP.NET App routing for SPA
using System;
using System.Diagnostics;
using System.Security.Claims;
using System.Web.Mvc;
namespace ISS.OPF.API.Controllers
{
// [Authorize] - you don't need authorization if all page auth is handled in frontend
public class HomeController : Controller
{
@jhauge
jhauge / web.config
Created December 12, 2017 11:39
Common mimemaps for azure web apps
<configuration>
<system.webServer>
<staticContent>
<remove fileExtension=".svg"/>
<mimeMap fileExtension=".svg" mimeType="image/svg+xml"/>
<remove fileExtension=".json"/>
<mimeMap fileExtension=".json" mimeType="application/json" />
<remove fileExtension="woff"/>
<mimeMap fileExtension="woff" mimeType="font/woff"/>
<remove fileExtension="woff2"/>
# This script pushes the database on to the dbserver in the script
# using the $fileName in arg, and names new database from $dbname in args
param($dbname, $fileName)
$dbserver = 'server.name.domain'
$username = 'username'
$password = 'password'
& sqlpackage /a:import /tsn:"$dbserver" /tdn:"$dbname" /tu:"$username" /tp:"$password" /sf:"$fileName"
# Start powershell som admin, og brug nedenstående kommandoer
# Tillad afvikling af downloadede powershell scripts
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
# Installer Chocolatey
iwr https://chocolatey.org/install.ps1 -UseBasicParsing | iex
# Genstart powershell som admin - nu kan man installere navngivne pakker fx chrome, google drive og skype:
choco install googlechrome -y
choco install googledrive -y
// Setup
fill('balsa')
homework = stamp('homework')
exploding = true
alarm = stamp('alarm',650,100,180)
alarm.tap = soundAlarm
// Start nedtælling til eksplosion
function soundAlarm() {
sound('alert',25,100)
@jhauge
jhauge / myRewrites.config
Created September 22, 2016 12:45
External file for rewrite rules
<rules>
<rule name="some rule">
<!-- rule details here --->
</rule>
</rules>