Skip to content

Instantly share code, notes, and snippets.

Avatar
👨‍🚒

Johan Andersson anderssonjohan

👨‍🚒
View GitHub Profile
View signalmeter.xaml
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Background="Wheat">
<Grid>
<Canvas Width="16" Height="16" SnapsToDevicePixels="True" ClipToBounds="True">
<Canvas.Resources>
<SolidColorBrush x:Key="LevelBrush" Color="White"/>
<SolidColorBrush x:Key="NoLevelBrush" Color="Transparent"/>
<SolidColorBrush x:Key="LevelBarBorder" Color="Gray"/>
</Canvas.Resources>
@anderssonjohan
anderssonjohan / svorak.ahk
Last active Nov 1, 2021
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
; ..to get Ctrl next to spacebar so most Cmd key bindings are where the mac user muscle memory says they should be :)
LWin::LAlt
LAlt::LCtrl
@anderssonjohan
anderssonjohan / get-volumeinformation.ps1
Created Feb 26, 2021
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
anderssonjohan / eop_github_actions.svg
Created Sep 2, 2020
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
anderssonjohan / default.conf
Created Oct 30, 2019
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
anderssonjohan / upload-and-attach-files.md
Last active Oct 21, 2019
Upload and attach file to a case in Lime Field
View upload-and-attach-files.md

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 '{}' https://appname.remotex.net/api/files/
< HTTP/2 201
< content-type: application/json
&lt; content-length: 421
@anderssonjohan
anderssonjohan / github_projects_condensed.css
Last active Oct 29, 2020
GitHub Projects condensed-and-more-like-waffle.io view, used with Stylus and optionally https://github.com/StylishThemes/GitHub-Dark
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
anderssonjohan / setup-volume.ps1
Created Sep 13, 2017
user data script to initialize, partition and format ebs volume /dev/xvd[drive letter]
View setup-volume.ps1
function setup-volume {
param(
[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
View keybase.md

Keybase proof

I hereby claim:

  • I am anderssonjohan on github.
  • I am anderssonjohan (https://keybase.io/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: