Skip to content

Instantly share code, notes, and snippets.

View henningjensen's full-sized avatar

Henning Jensen henningjensen

View GitHub Profile
@henningjensen
henningjensen / CacheController.cs
Created February 4, 2022 09:08
dotnet api controller run long running job - populate cache example
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
namespace MyNamespace.Controllers;
[Route("/api/cache")]
[ApiController]
public class CacheController : ControllerBase
{
@henningjensen
henningjensen / exiftool.md
Last active November 17, 2018 20:45
exiftool cheat sheat

Rename files according to date taken

  • rename according to DateTimeOriginal-tag

  • lowercase the file extension

  • recursive from current directory

  • move to output directory in a date hierarchy

    $ exiftool -progress "-filename<DateTimeOriginal" -d "output/%Y/%Y-%m/%Y-%m-%d_%H%M%S%%-c.%%le" -r .

MP4 video files from cellphone

@henningjensen
henningjensen / index.html
Created December 9, 2015 09:56
Kartverket - Leaflet with UTM33 projection - add markers and features.
<div id="map" width="500" height="500"></div>
<script type="text/javascript">
(function () {
L.Icon.Default.imagePath = '/Content/img/leaflet/';
var crs = L.CRS.proj4js('EPSG:32633', '+proj=utm +zone=33+ellps=WGS84 +datum=WGS84 +units=m +no_defs', new L.Transformation(1, 2500000, -1, 9045984));
crs.scale = function (zoom) {
return 1 / (21674.7100160867 / Math.pow(2, zoom));
@henningjensen
henningjensen / print.sh
Created November 22, 2017 21:12
Printing multiple files in Ubuntu with Nautilus script
#!/bin/bash
#
# print.sh
#
# credits original script:
# http://www.frenssen.be/2010-05-09-printing-a-file-from-the-right-click-context-menu-in-nautilus/
#
# Print files from the right-click context menu in Nautilus.
# Place this script in ~/.local/share/nautilus/scripts/
@henningjensen
henningjensen / keybase.md
Last active October 28, 2017 20:36
keybase.md

Keybase proof

I hereby claim:

  • I am henningjensen on github.
  • I am henningjensen (https://keybase.io/henningjensen) on keybase.
  • I have a public key ASA3YPHroJWsQQyh8z0sf1emZxn-I_5x-kQd0oIpQB8bVwo

To claim this, I am signing this object:

@henningjensen
henningjensen / gist:1145089
Created August 14, 2011 17:22
Join/merge PDF files with pdftoolkit
sudo apt-get install pdftk
pdftk file1.pdf file2.pdf cat output newFile.pdf
@henningjensen
henningjensen / 0_reuse_code.js
Created December 5, 2016 11:49
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@henningjensen
henningjensen / gist:5796361
Created June 17, 2013 11:56
XSL inspect node names and values.
<xsl:for-each select="$metadata/*">
<xsl:value-of select="name()" /> = <xsl:value-of select="node()" /><br/>
</xsl:for-each>
@henningjensen
henningjensen / gist:5590006
Created May 16, 2013 07:27
Visual Studio ASP MVC 4 - Run all migrations on an empty database.
Update-Database -Script -SourceMigration $InitialDatabase
@henningjensen
henningjensen / gist:5213330
Created March 21, 2013 14:15
.Net find all resource names in assembly
System.Diagnostics.Debug.WriteLine(string.Join(", ", GetType().Assembly.GetManifestResourceNames()));