Skip to content

Instantly share code, notes, and snippets.

View Zazcallabah's full-sized avatar

Peter Hamberg Zazcallabah

View GitHub Profile
@Zazcallabah
Zazcallabah / Microsoft.PowerShell_profile.ps1
Created February 17, 2020 10:59
psprofile for pwsh core linux
set-alias -name ls -value Get-ChildItem
set-alias -name sc -value Set-Content
$culture = [CultureInfo]::InvariantCulture.Clone()
$currentThread = [System.Threading.Thread]::CurrentThread
$culture.DateTimeFormat.DateSeparator = "-"
$culture.DateTimeFormat.FirstDayOfWeek = "Monday"
$culture.DateTimeFormat.ShortDatePattern = "yyyy-MM-dd"
$currentThread.CurrentCulture = $culture
$currentThread.CurrentUICulture = $culture
@Zazcallabah
Zazcallabah / proget-image-sizes.ps1
Last active February 10, 2020 12:28
Get docker repository file size info from proget, grouped by package
$key = "<key with native api access>"
$uribase="http://<proget server>/api/json/"
$feedid = <feed id>
$packages = Invoke-webrequest "$($uribase)DockerImages_GetRepositories?key=$($key)&Feed_ID=$feedid" | select -expandproperty Content | convertfrom-json
$size_lookup = @{}
$data = @()
$total = $packages.length
@Zazcallabah
Zazcallabah / nifty-chat.user.js
Last active May 26, 2020 19:43
I cut apart the nifty chat monitor script to make it only do inline images, and to also do them on vods.
// ==UserScript==
// @name Nifty Chat Monitor
// @namespace http://somewhatnifty.com
// @description reformats twitch chat for display on a chat monitor
// @match https://www.twitch.tv/*
// @version 0.4
// @require https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js
// @grant GM_getResourceText
// @grant GM_addStyle
// @require https://raw.githubusercontent.com/sizzlemctwizzle/GM_config/master/gm_config.js
@Zazcallabah
Zazcallabah / android-sound-fix
Created November 11, 2019 08:29
disables the nag-notification about high headphone volume on android
adb root
adb pull /system/build.prop
echo "audio.safemedia.bypass=true" >> ./build.prop
adb shell
mount -o rw,remount /system
exit
adb push ./build.prop /system
card an unusual wager: look <- only useful when needing coins
https://fallenlondon.fandom.com/wiki/Cave_of_the_Nadir_(Guide)
Poet-Laureate and Paramount Presence.
A few terms as Governor (the highest title is at twelve terms).
Increase your Renown with various factions.
Become Stormy-Eyed.
Increase your Quirks.
@Zazcallabah
Zazcallabah / ubo.md
Last active July 19, 2019 15:01
Ublock Origin filters for twitter feed

block any likes from appearing in your feed

twitter.com##article:has(> div:nth-of-type(1):has(> div:nth-of-type(1):has(> div:nth-of-type(1):has(> svg:has(> g:has(path[d="M12 21.638h-.014C9.403 21.59 1.95 14.856 1.95 8.478c0-3.064 2.525-5.754 5.403-5.754 2.29 0 3.83 1.58 4.646 2.73.814-1.148 2.354-2.73 4.645-2.73 2.88 0 5.404 2.69 5.404 5.755 0 6.376-7.454 13.11-10.037 13.157H12z"]))))))

block "x replied"

twitter.com##article:has(> div:nth-of-type(1):has(> div:nth-of-type(1):has(> div:nth-of-type(1):has(> svg:has(> g:has(path[d="M14.046 2.242l-4.148-.01h-.002c-4.374 0-7.8 3.427-7.8 7.802 0 4.098 3.186 7.206 7.465 7.37v3.828c0 .108.044.286.12.403.142.225.384.347.632.347.138 0 .277-.038.402-.118.264-.168 6.473-4.14 8.088-5.506 1.902-1.61 3.04-3.97 3.043-6.312v-.017c-.006-4.367-3.43-7.787-7.8-7.788z"]))))))
@Zazcallabah
Zazcallabah / noTwitchAutoplay.user.js
Last active January 29, 2020 21:53
stop twitch from autoplaying the next vod
// ==UserScript==
// @name Prevent Twitch autoplay
// @version 0.2
// @match https://www.twitch.tv/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
function _go(){

PowerShell Gotchas!

I find PowerShell incredibly useful. It does, however, have a lot of quirks that make for very annoying why-would-you-ever-make-it-do-that moments. The following is my attempt to list and clarify these small oddities.

This is not a generic guide to using a console, nor is it a general scripting guide. There are much better resources for that found elsewhere.

terminal

You have a bunch of options regarding terminals to run powershell. I know a bunch of people that are very happy with cmder. I personally use Windows Terminal because it has QuakeMode which is more useful than you would think. I suggest you find one that fits you, as long as it isnt cmd.exe.

@Zazcallabah
Zazcallabah / AzureLogin.ps1
Created December 3, 2018 11:26
Azure Service Principal Login
$uri = "https://login.microsoftonline.com/$($tenant)/oauth2/token"
$data = @{
"resource"="https://management.core.windows.net/";
"client_id"=$servicePrincipalGuid;
"client_secret"=$secret;
"grant_type"="client_credentials";
}
return Invoke-WebRequest -Method POST -Uri $uri -Headers $headers -Body $data | ConvertFrom-Json
@Zazcallabah
Zazcallabah / wol.ps1
Created October 17, 2018 09:18
Wake-on-lan trigger
param ([String]$mac = "00:11:22:33:00:11")
$MACAddr = $mac.split(':') | %{ [byte]('0x' + $_) };
$UDPclient = new-Object System.Net.Sockets.UdpClient
$UDPclient.Connect(([System.Net.IPAddress]::Broadcast),4000)
$packet = [byte[]](,0xFF * 6)
$packet += $MACAddr * 16;
[void] $UDPclient.Send($packet, $packet.Length)