Skip to content

Instantly share code, notes, and snippets.

View anderssonjohan's full-sized avatar
👨‍🚒

Johan Andersson anderssonjohan

👨‍🚒
View GitHub Profile
@anderssonjohan
anderssonjohan / delete-deployment.ps1
Last active May 10, 2023 14:27
Get and delete deployments for a github repository
param(
$owner,
$repository_name,
$databaseid
)
gh api --method DELETE -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /repos/$owner/$repository_name/deployments/$databaseid
@anderssonjohan
anderssonjohan / build-pendulum-wheels.yml
Created March 31, 2023 11:27
Fix arm wheels created with x86_64 platform tag based on https://github.com/pypa/cibuildwheel/pull/1416
name: Build
on: [push, pull_request]
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
@anderssonjohan
anderssonjohan / signalmeter.xaml
Created December 23, 2021 12:06
XAML examples
<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 November 1, 2021 23:32
My us dvorak key mappings for Swedish characters åäö + mac key bindings for swapping LAlt->LCtrl, LCtrl->LWin, LWin->LAlt
#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 February 26, 2021 14:23
Script to enumerate filesystem info for the volumes collected by metricbeat, which stopped working from version 7.11
$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 September 2, 2020 12:39
EOP with GitHub Actions and repository_dispatch + PAT
Loading
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 October 30, 2019 08:43
Run oauth2_proxy with nginx auth_request but not if the client already prestented HTTP credentials (basic auth)
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 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 '{}' 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 October 29, 2020 14:08
GitHub Projects condensed-and-more-like-waffle.io view, used with Stylus and optionally https://github.com/StylishThemes/GitHub-Dark
.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 September 13, 2017 18:13
user data script to initialize, partition and format ebs volume /dev/xvd[drive letter]
function setup-volume {
param(
[parameter(mandatory=$true,helpmessage="drive letter")]
[string] $driveletter,
[parameter(mandatory=$false,helpmessage="file system label")]
[string] $label = ""
)
$driveletter = $driveletter.ToLower()