Skip to content

Instantly share code, notes, and snippets.

@noseratio
noseratio / adb-clear-packages.ps1
Last active October 5, 2024 19:55
Clear all Android packages and user data via ADB
# Clear all Android packages and user data via ADB, by @noseratio
# Run: powershell -f adb-clear-packages.ps1
# To get ADB: https://community.chocolatey.org/packages/adb
#
# Q: Why not a factory reset?
# A: https://www.reddit.com/r/Android/comments/naetg8/a_quick_powershell_script_for_clearing_user_data/gxtaswl?context=3
$confirmation = Read-Host "This will clear all packages data and user files. Are you sure you want to proceed? (y|n)"
if ($confirmation -ne 'y') {
return
@tg12
tg12 / remove_expiredcerts.ps1
Created April 15, 2021 08:20
Remove all Expired Certs on a Windows Machine
# """THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
# NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE
# DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OTHER LIABILITY,
# WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE."""
# Bitcoin Cash (BCH) qpz32c4lg7x7lnk9jg6qg7s4uavdce89myax5v5nuk
@ByronScottJones
ByronScottJones / select-capturegroup.ps1
Created March 21, 2021 19:20
Select Capture Group and return PSCustomObject
function Select-CaptureGroup {
[CmdletBinding()]
param (
[Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true)]
[ValidateNotNullOrEmpty()]
[Microsoft.PowerShell.Commands.MatchInfo[]]$InputObject
)
begin {}
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'dart:convert';
import 'package:dio/dio.dart';
import "dart:math";
void main() {
runApp(MyApp());
}
@apfelchips
apfelchips / Profile.ps1
Last active April 13, 2025 16:14
my crossplatform PowerShell Profile
# Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
# src: https://gist.github.com/apfelchips/62a71500a0f044477698da71634ab87b
# New-Item $(Split-Path "$($PROFILE.CurrentUserCurrentHost)") -ItemType Directory -ea 0; Invoke-WebRequest -Uri "https://git.io/JYZTu" -OutFile "$($PROFILE.CurrentUserCurrentHost)"
# ref: https://devblogs.microsoft.com/powershell/optimizing-your-profile/#measure-script
# ref: Powershell $? https://stackoverflow.com/a/55362991
# ref: Write-* https://stackoverflow.com/a/38527767
# Write-Host wrapper for Write-Information -InformationAction Continue
@m-radzikowski
m-radzikowski / script-template.sh
Last active May 22, 2025 17:41
Minimal safe Bash script template - see the article with full description: https://betterdev.blog/minimal-safe-bash-script-template/
#!/usr/bin/env bash
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
usage() {
cat <<EOF
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...]
@zbalkan
zbalkan / Start-WindowsActivation.ps1
Last active February 8, 2025 16:08
It's a drop-in replacement for slmgr.vbs script
#Requires -RunAsAdministrator
#Requires -Version 5
<#
.Synopsis
Activates Windows via KMS
.DESCRIPTION
It's a drop in replacement for slmgr scripts
.EXAMPLE
Start-WindowsActivation -Verbose # Activates the local computer
.EXAMPLE
<#
Create Unix VM's.
PREREQUISITES:
- A VM that has been installed with an OS that supports cloud-init
- cloud-init is installed on the vm
How it works:
- Asks for a bunch of parameters
- Creates a disk from parent vhdx for speed
@NotNotWrongUsually
NotNotWrongUsually / gist:7db8f3f7abd88a95868284652232b9af
Created October 6, 2019 11:50
Grab image from AD and rescale if desired
function UserPhoto ($user, [int]$width, [int]$height) {
$user_data = ([adsisearcher]"(&(objectClass=user)(sAMAccountName=$user))").FindAll()
$stream = [System.Io.MemoryStream]::new($user_data.Properties["thumbnailphoto"][0])
$img = [System.Drawing.Image]::FromStream($stream)
if ($width -or $height) {
if (-not $width) {
$width = ($img.Width / $img.height) * $height
}
@johnandersen777
johnandersen777 / .gitignore
Last active May 30, 2024 16:41
Setting Up k3s for Serverless (knative) on a $5 DigitalOcean Droplet Using k3d
.terraform/
*.pem
*.tf
*.tfstate
*.yaml
*.backup
istio-*/
cert-manager-*/
*.swp
env