Skip to content

Instantly share code, notes, and snippets.

View matsest's full-sized avatar

Mats Estensen matsest

View GitHub Profile
@matsest
matsest / keybase.md
Last active November 18, 2018 20:20

Keybase proof

I hereby claim:

  • I am matsest on github.
  • I am matsest (https://keybase.io/matsest) on keybase.
  • I have a public key ASCKiorQnOyu-YB3yJ8nC0468Gz8X0QbjTQCbq1WL2ZrZAo

To claim this, I am signing this object:

@matsest
matsest / pandoc-setup.md
Last active May 7, 2021 10:08
pandoc-latex-setup

Pandoc Setup

Description

A simple setup for Sublime to jot down notes in Markdown and compile a nice PDF with LaTeX through Pandoc conversion.

Why? Markdown is quick and easy to write, LaTeX is more of a hassle. But LaTeX produces nice PDFs. Using Pandoc, you can utilize the best features of both worlds by writing in markdown and compiling PDFs with LaTeX, with a simple one-click in your editor. This works fairly well for simple documents and pandoc supports most of Markdown syntax, in addition to supporting a range of variables set in a YAML meta block. Did I mention that it also supports writing LaTeX-style math and other LaTeX-commands in your Document? (Like this: $e^{i\pi}+1 = 0$ )

The output PDF is a A4 paper with 12pt font and 1 inch margins. It uses fancyhead to style the header and footer with date, pagenumbering and title/author. (This can be changed in your Pandoc-settings)

@matsest
matsest / build-and-deploy.sh
Created November 21, 2018 21:38
A simple build and deploy script too publish my site https://github.com/matsest/matsest.github.io
#!/bin/bash
echo -e "\033[0;32mDeploying updates to GitHub...\033[0m"
echo -e "\033[0;32mRemoving old files...\033[0m"
rm -r public/*
# Build the project.
echo -e "\033[0;32mBuilding new site...\033[0m"
hugo --minify
@matsest
matsest / touchscreen-off.sh
Last active April 24, 2022 21:40
disable-lenovo-x1-touchpad-on-startup
#!/bin/bash
ID=$(/usr/bin/xinput list --id-only "Wacom Pen and multitouch sensor Finger")
if [[ $ID ]]; then
/usr/bin/xinput --disable $ID
fi
@matsest
matsest / stopZoomScroll.ahk
Created March 23, 2020 12:26
AutoHotKey script to stop annoying behaviour on laptops where ctrl+scroll on touchpad leads to unintentional zooms
#MaxHotkeysPerInterval 500
^WheelDown::return
^WheelUp::return
Get-Module -Name az.* -ListAvailable |
Where-Object -Property Name -ne ‘Az.’ |
ForEach-Object {
$currentVersion = [Version] $_.Version
$newVersion = [Version] (Find-Module -Name $_.Name).Version
if ($newVersion -gt $currentVersion) {
Write-Host -Object "Updating $_ Module from $currentVersion to $newVersion"
Update-Module -Name $_.Name -RequiredVersion $newVersion -Force
Uninstall-Module -Name $_.Name -RequiredVersion $currentVersion -Force
}
@matsest
matsest / check-expired-apps.ps1
Created January 7, 2022 14:24
az-service-principal
#requires -modules @{ ModuleName="Az.Resources"; ModuleVersion="5.0.0" }
[CmdletBinding()]
param(
[Parameter(HelpMessage = 'Will output credentials if withing this number of days, use 0 to report only expired and valid as of today')]
$ExpiresInDays = 90
)
Write-Host 'Gathering necessary information...'
$applications = Get-AzADApplication
@matsest
matsest / servicetags.ps1
Created February 16, 2022 11:19
azure network tags
$serviceTagCollections = Get-AzNetworkServiceTag -Location "Norway East"
$serviceTags = $serviceTagCollections | Where-Object Name -eq "Public" | Select-Object -ExpandProperty Values
$regionalServices = $serviceTags | ? { $_.Properties.Region -like "norway*" }
$nonRegionalServices = $serviceTags | ? { -not $_.Properties.Region }
@matsest
matsest / main.bicep
Last active August 17, 2022 06:35
Management Group Diagnostic Settings
targetScope = 'managementGroup'
param name string
param displayName string = name
param parentName string = ''
param workspaceResourceId string = ''
resource managementGroup 'Microsoft.Management/managementGroups@2021-04-01' = {
name: name
scope: tenant()
@matsest
matsest / asg-in-nsg-rules.kql
Last active February 26, 2025 09:25
Various Azure Resource Graph queries
resources
| where type == "microsoft.network/networksecuritygroups"
| extend securityRules = properties.securityRules
| mv-expand securityRules
| where securityRules.properties.destinationApplicationSecurityGroups != '' or securityRules.properties.sourceApplicationSecurityGroups != ''
| mv-expand srcAsgs = securityRules.properties.sourceApplicationSecurityGroups
| mv-expand dstAsgs = securityRules.properties.destinationApplicationSecurityGroups
| extend srcAsgNames = split(srcAsgs.id, "/")[-1]
| extend dstAsgNames = split(dstAsgs.id, "/")[-1]
| mv-expand subnet = properties.subnets