Skip to content

Instantly share code, notes, and snippets.


Johan Andersson anderssonjohan

View GitHub Profile
anderssonjohan / signalmeter.xaml
Created December 23, 2021 12:06
XAML examples
View signalmeter.xaml
xmlns:x="" Background="Wheat">
<Canvas Width="16" Height="16" SnapsToDevicePixels="True" ClipToBounds="True">
<SolidColorBrush x:Key="LevelBrush" Color="White"/>
<SolidColorBrush x:Key="NoLevelBrush" Color="Transparent"/>
<SolidColorBrush x:Key="LevelBarBorder" Color="Gray"/>
anderssonjohan / svorak.ahk
Last active November 1, 2021 23:32
My us dvorak key mappings for Swedish characters åäö + mac key bindings for swapping LAlt->LCtrl, LCtrl->LWin, LWin->LAlt
View svorak.ahk
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
; Keys on dell laptop: LCtrl, Fn, LWin, LAlt
; Result: LWin, Fn, LAlt, LCtrl
; get Ctrl next to spacebar so most Cmd key bindings are where the mac user muscle memory says they should be :)
anderssonjohan / get-volumeinformation.ps1
Created February 26, 2021 14:23
Script to enumerate filesystem info for the volumes collected by metricbeat, which stopped working from version 7.11
View get-volumeinformation.ps1
$pinvokes = @'
[DllImport("Kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public extern static bool GetVolumeInformationW(
string rootPathName,
System.Text.StringBuilder volumeNameBuffer,
int volumeNameSize,
out uint volumeSerialNumber,
out uint maximumComponentLength,
out uint fileSystemFlags,
anderssonjohan / eop_github_actions.svg
Created September 2, 2020 12:39
EOP with GitHub Actions and repository_dispatch + PAT
View eop_github_actions.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
anderssonjohan / default.conf
Created October 30, 2019 08:43
Run oauth2_proxy with nginx auth_request but not if the client already prestented HTTP credentials (basic auth)
View default.conf
server {
listen 80;
server_name localhost;
location /oauth2/ {
proxy_pass http://oauth-proxy:4180;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Scheme $scheme;
proxy_set_header X-Auth-Request-Redirect $request_uri;
anderssonjohan /
Last active October 21, 2019 16:58
Upload and attach file to a case in Lime Field

Step 1 - POST to api/files to create a file object

$ curl -v -u user:pass -H 'Accept: application/json' -H 'Content-Type: application/json' \ 
  -d '{}'
< HTTP/2 201
< content-type: application/json
&lt; content-length: 421
anderssonjohan / github_projects_condensed.css
Last active October 29, 2020 14:08
GitHub Projects view, used with Stylus and optionally
View github_projects_condensed.css
.project-columns-container {
padding: 0px !important;
.project-column {
border-radius: 0px !important;
border-right-width: 0px !important;
margin-right: 0px !important;
min-width: 300px;
.card-octicon {
anderssonjohan / setup-volume.ps1
Created September 13, 2017 18:13
user data script to initialize, partition and format ebs volume /dev/xvd[drive letter]
View setup-volume.ps1
function setup-volume {
[parameter(mandatory=$true,helpmessage="drive letter")]
[string] $driveletter,
[parameter(mandatory=$false,helpmessage="file system label")]
[string] $label = ""
$driveletter = $driveletter.ToLower()
View profile.ps1
# Add this line to your profile.ps1
. $PSScriptRoot\vsvars.ps1

Keybase proof

I hereby claim:

  • I am anderssonjohan on github.
  • I am anderssonjohan ( on keybase.
  • I have a public key whose fingerprint is F668 8115 9A5A 8E65 A325 88CB 4530 2BE0 9334 A9FE

To claim this, I am signing this object: