Skip to content

Instantly share code, notes, and snippets.

@jwmcgettigan
jwmcgettigan / bitwarden_duplicate_cleaner.py
Last active April 10, 2024 03:45
Identifies and removes duplicate 'items' and 'folders' from your Bitwarden vault. 🎃
#!/usr/bin/env python3
# Copyright © 2023 Justin McGettigan
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software
# and associated documentation files (the “Software”), to deal in the Software without
# restriction, including without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all copies or
@JohnLBevan
JohnLBevan / Get-AsgMembers.ps1
Created July 7, 2021 13:31
Query to list all of an application security group (ASG)'s members (VMs). Thanks to Clive for the graph query. https://feedback.azure.com/forums/217313-networking/suggestions/35655277-show-membership-of-application-security-groups
# https://docs.microsoft.com/en-us/azure/governance/resource-graph/first-query-powershell#run-your-first-resource-graph-query
# Install-Module -Name Az.ResourceGraph # - installs the module; no need to run if you've previously installed this.
# Login-AzAccount # brings up a web browser to log you in to Azure (interactive) so PS can run under your credentials
# Set-AzContext -SubscriptionId '0000000-1111-etc' # use this to target the subscription your resources live in; amending the subscrcription id as needed
(Search-AzGraph -Query @'
Resources
| where type =~ 'Microsoft.Compute/virtualMachines'
| project name, nics = properties.networkProfile.networkInterfaces
| mvexpand nics
@JohnLBevan
JohnLBevan / Remove-AzTagTrailingSpace.ps1
Created July 2, 2021 12:03
Remove trailing spaces from Azure tag names
#
# Rough and ready script to clean up trailing spaces from tag names
# Loops through all resources and resource groups under all subscriptions to which you have access.
# If a resource isn't already tagged with the clean (same name with no trailing space) then the clean tag name is given the diry tag's value, and the dirty tag is removed.
# If a resource has both clean and dirty tags, this shows a warning (even if the values are the same... I was lazy / didn't add a check for that) and leaves to the caller to fix manually.
# If a resource doesn't have any dirty tags, it's not affected.
#
Clear-Host
Login-AzAccount # (interactive / opens web browser)
@dscho
dscho / github-release-download-counts.user.js
Last active October 9, 2023 01:09 — forked from kusaanko/Show download count of GitHub release for Tampermonkey.user.js
Show download counts of GitHub releases (Tampermonkey script)
// ==UserScript==
// @name Show download counts of GitHub releases
// @description Displays the download count of GitHub's release.
// @version 0.3
// @source https://gist.github.com/dscho/5d171ec286a52ca4c699477cceaebe20
// @updateURL https://gist.github.com/dscho/5d171ec286a52ca4c699477cceaebe20/raw/github-release-download-counts.user.js
// @downloadURL https://gist.github.com/dscho/5d171ec286a52ca4c699477cceaebe20/raw/github-release-download-counts.user.js
// @namespace http://tampermonkey.net/
// @author Kusaanko, Johannes Schindelin
// @match https://github.com/*/*/releases*
@anelliaf
anelliaf / az_getSQLDatabaseListInExcel.ps1
Created October 1, 2020 18:05
PowerShell script to list all Azure SQL Databases in a Azure Subscription
PARAM(
[string] [Parameter(Mandatory = $True, HelpMessage = "Choose subscription you want be inventored")] $SubscriptionName
)
#Variables
$ReportDate = (Get-Date).ToString("yyyy-MM-dd HH:mm")
#Login to Azure
Connect-AzAccount
@dreamer2908
dreamer2908 / register_baidu.md
Last active May 5, 2024 17:13
Register a Baidu account to download stuff???

Idea from ShinyMarusu @ Reddit:

  • https://www.reddit.com/r/Piracy/comments/auhyxk/how_do_i_download_from_panbaidu/eovyg8g/
  • I just unintentionally discovered how to do it after searching how to create an account for day and a half. LOL hope it works for you too.
  • First go to this link (baidu cloud app) to register. Use your phone number to get the verification code and enter. For the rest, use google to translate the page and put your email adress, name, etc. and you're good to go. This method logs you to the cloud directly so you just step over the problematic pan,baidu registration which rejects non-chinese phone numbers for some reason. After registering I refreshed the page of the file I was trying to download and it showed me as already logged in, then I FINALLY could download the mod. It's sad this method isn't listed anywhere, I really searched a lot... Anyways, good luck!

More notes:

  • It's a pain in the rear. It took me an hour, but at least it worked.
  • Get an Chinese email. You will use it as yo
@larryclaman
larryclaman / convert-to-spot.ps1
Created April 8, 2020 19:23
Convert an Azure VM to a Spot VM type
<# Convert a VM to a Spot VM
Based on sample script at https://docs.microsoft.com/en-us/azure/virtual-machines/windows/change-availability-set
NOTE: Extensions will not be copied to new instance!!
#>
# Set variables to your specifics
$resourceGroup = "myRG"
$vmName = "myVM"
# Get the details of the VM to be moved to the Availability Set
@DanielSmon
DanielSmon / New MS Teams Profile.cmd
Last active April 29, 2024 19:23
For running multiple MS Teams accounts side by side. Save this with the name of the MS Teams profile you wish to use. When launched, a folder will be created in your user profile. See https://danielsmon.com/2020/04/02/multiple-ms-teams-accounts-on-the-desktop/.
@ECHO OFF
REM Uses the file name as the profile name
SET MSTEAMS_PROFILE=%~n0
ECHO - Using profile "%MSTEAMS_PROFILE%"
SET "OLD_USERPROFILE=%USERPROFILE%"
SET "USERPROFILE=%LOCALAPPDATA%\Microsoft\Teams\CustomProfiles\%MSTEAMS_PROFILE%"
REM Ensure there is a downloads folder to avoid error described at
@SeidChr
SeidChr / Set-SlackStatus.ps1
Last active October 24, 2023 11:48
Set Slack Status via Powershell
param($token, $statusText, $emojiCode)
$baseUri = 'https://slack.com/api/users.profile.set'
$json = '{"status_text":"'+$statusText+'","status_emoji":"'+$emojiCode+'","status_expiration":0}'
$jsonEncoded = [uri]::EscapeDataString($json)
$uri = $baseUri + "?token=$token&profile=$jsonEncoded"
Invoke-WebRequest -Method Post -Uri $uri | Out-Null
param($statusText, $emojiCode)
$baseUri = 'https://slack.com/api/users.profile.set'