Skip to content

Instantly share code, notes, and snippets.

View yooakim's full-sized avatar
⌨️
Focusing

Joakim Westin yooakim

⌨️
Focusing
View GitHub Profile
@yooakim
yooakim / gist:276cbdebd841b5def31fdac3cb533f17
Last active February 15, 2024 07:13
Download duckdb CLI (Linux)
# Set the GitHub API URL for the latest release of duckdb
API_URL="https://api.github.com/repos/duckdb/duckdb/releases/latest"
# Use curl to fetch the latest release data and grep to extract the asset's browser_download_url
DOWNLOAD_URL=$(curl -s $API_URL | grep -oP '"browser_download_url": "\K(.*duckdb_cli-linux-amd64.zip)')
# Download the latest release using the extracted URL
curl -L $DOWNLOAD_URL -o duckdb_cli-linux-amd64.zip
# Create the target directory if it doesn't exist
@yooakim
yooakim / gist:618c67d10a344c0bdeec17e4e9aba73a
Created February 7, 2024 10:18
Install Cascadya COver Nerdfont on Ubuntu
sudo apt install wget fontconfig \
&& wget -P ~/.local/share/fonts https://github.com/ryanoasis/nerd-fonts/releases/download/v3.1.1/CascadiaCode.zip \
&& cd ~/.local/share/fonts && unzip CascadiaCode.zip && rm *Windows* && rm CascadiaCode.zip && fc-cache -fv
@yooakim
yooakim / gist:f319abd453f1b62e21e588d7f797ac28
Created September 7, 2023 05:09
enable-az-web-account-manager
# [Windows only] Azure CLI is collecting feedback on using the Web Account Manager (WAM) broker for the login experience.
#
# You may opt-in to use WAM by running the following commands:
az config set core.allow_broker=true
az account clear
az login
@yooakim
yooakim / Get-PublicIPs.ps1
Last active August 25, 2022 07:41
Simple PowerShell + AZ CLI to get public IP addresse from all subscriptions I have access to
$Subscriptions = az account list --query '[].{Id:id,Name:name,TenantId:tenantId}' | ConvertFrom-Json
$PublicIPs=$Subscriptions | % { az network public-ip list --query '[].{Name:name,PublicIP:ipAddress,Version:publicIpAddressVersion,Method:publicIpAllocationMethod,SKU:sku.name,ResourceGroup:resourceGroup,DNS:dnsSettings.fqdn,d:id}' --subscription $_.Id -o json | ConvertFrom-Json }
$PublicIPs | select Name,PublicIP, ResourceGroup, SKU, Version, Method | Sort-Object Name | Format-Table -AutoSize
$PublicIPs
https://management.azure.com/subscriptions/{{subscriptionId}}/providers/Microsoft.Billing/billingPeriods/{{billingPeriod}}/providers/Microsoft.Consumption/usageDetails?$apply=filter(properties/usageEnd ge '{{startDate}}' AND properties/usageEnd le '{{endDate}}')/groupby((tags/Customer),aggregate(properties/cost with sum as TotalCost))&api-version=2021-10-01
@yooakim
yooakim / tenant-roles.bicep
Last active August 18, 2021 08:06
Assign roles Owner and Contributor to Azure AD groups at the tenant level
targetScope = 'tenant'
// Groups defined in Azure AD
var AzureAdmininstrators = '<ourprivateguidfortheADgroup>'
var AzureSubscriptionOwners = '<ourprivateguidfortheADgroup>'
// Azure built-in role IDs (see: https://docs.microsoft.com/en-us/azure/role-based-access-control/built-in-roles)
var OwnerRoleDefinitionId = '8e3af657-a8ff-443c-a75c-2fe8c4bcb635'
var ContributorRoleDefinitionId = 'b24988ac-6180-42a0-ab88-20f7382dd24c'
Set-MpPreference -ExclusionPath @('\\wsl$\Ubuntu',"$ENV:USERPROFILE\source") -ExclusionProcess @('devenv','Code','sqlservr','msbuild') -ExclusionExtension @('vhdx','vhd','bacpac','dacpac','wsl','wslhost')
Invoke-WebRequest -Uri https://aka.ms/downloadazcopy-v10-windows -OutFile ~\Downloads\azcopy.zip
Unblock-File ~\Downloads\azcopy.zip
Expand-Archive ~\Downloads\azcopy.zip
Copy-Item ~\Downloads\azcopy\*\azcopy.exe C:\apps\tools -Force
Remove-Item ~\Downloads\azcopy -Recurse -Force
@yooakim
yooakim / Update-Sysinternals.ps1
Created March 13, 2021 09:54
Update SysinternalsSuite
Invoke-WebRequest -Uri https://download.sysinternals.com/files/SysinternalsSuite.zip -OutFile ~\Downloads\SysinternalsSuite.zip
Unblock-File ~\Downloads\SysinternalsSuite.zip
Expand-Archive ~\Downloads\SysinternalsSuite.zip -DestinationPath ~\OneDrive\Util -Force
Remove-Item ~\Downloads\SysinternalsSuite.zip
@yooakim
yooakim / update-azcopy.sh
Last active February 4, 2020 12:19
Update AzCopy to latest version
#!/bin/bash
#
# Simple bash script for downloading and updating AzCopy to the latest available version.
#
# Go home
cd $HOME
# Download AzCopy
wget https://aka.ms/downloadazcopy-v10-linux --no-verbose