Skip to content

Instantly share code, notes, and snippets.

View sjorspa's full-sized avatar

Sjors Pals sjorspa

  • Amsterdam
View GitHub Profile
@sjorspa
sjorspa / duplicates.ps1
Created October 19, 2024 12:38
Delete duplicate files in folder
$list = New-Object Collections.Generic.List[String]
$results = Get-ChildItem -Path C:\backup2 -Recurse
foreach ($item in $results) {
if ($item.Attributes -ne 'Directory') {
$hash = Get-FileHash -LiteralPath $item.FullName
if ($hash.Hash -ne '') {
if ($list.Contains($hash.Hash)) {
try {
Remove-Item -LiteralPath $item.FullName -force -Recurse
}
@sjorspa
sjorspa / vsco.ps1
Last active September 20, 2024 07:09
$cont = $true
$next_cursor = ''
$list = New-Object Collections.Generic.List[String]
cls
while($cont){
$result = Invoke-WebRequest -UseBasicParsing -Uri "https://vsco.co/api/3.0/medias/profile?site_id=profileid&limit=14&cursor=$($next_cursor)" `
-Headers @{
"authority"="vsco.co"
"path"="/api/3.0/medias/profile?site_id=profileid&limit=14&cursor=$($next_cursor)"
"authorization"="Bearer xxxxxxxxxxxxxxxxxxxxxxxxxx"
@sjorspa
sjorspa / gist:f2e456a7f697203e8b9644894fe6bebd
Created February 15, 2024 12:04
Function App with Integrated Security Storage
@description('Specifies region of all resources.')
param location string = resourceGroup().location
@description('Suffix for function app, storage account, and key vault names.')
param appNameSuffix string = uniqueString(resourceGroup().id)
@description('Storage account SKU name.')
param storageSku string = 'Standard_LRS'
var functionAppName = 'fn-${appNameSuffix}'
var appServicePlanName = 'FunctionPlan'
var storageAccountName = 'fnstor${replace(appNameSuffix, '-', '')}'
$points = @()
$points += [PsCustomObject]@{team = 'ENG'; q = 0 }
$points += [PsCustomObject]@{team = 'IND'; q = 0 }
$points += [PsCustomObject]@{team = 'NED'; q = 0 }
$points += [PsCustomObject]@{team = 'PAK'; q = 0 }
$points += [PsCustomObject]@{team = 'AUS'; q = 0 }
$points += [PsCustomObject]@{team = 'SA'; q = 0 }
$points += [PsCustomObject]@{team = 'SL'; q = 0 }
$points += [PsCustomObject]@{team = 'BAN'; q = 0 }
$points += [PsCustomObject]@{team = 'NZ'; q = 0 }
using namespace System.Net
# Input bindings are passed in via param block.
param($Request, $TriggerMetadata)
# Write to the Azure Functions log stream.
Write-Host "PowerShell HTTP trigger function processed a request."
# Interact with query parameters or the body of the request.
$name = $Request.Query.Name