Skip to content

Instantly share code, notes, and snippets.

View MayerDaniel's full-sized avatar

Daniel Mayer MayerDaniel

  • New Orleans, LA
View GitHub Profile
@mgeeky
mgeeky / Enumerate-URIHandlers.ps1
Created January 12, 2022 12:24
Enumerate Windows URI Handlers (Keys in HKEY_CLASSES_ROOT that contain "URL Protocol" values), examples: http:, calculator:, ms-officecmd:
New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT -ErrorAction SilentlyContinue | Out-Null
$count = 0
try {
Get-ChildItem HKCR: -ErrorAction SilentlyContinue | ForEach-Object {
if((Get-ItemProperty $_.PSPath -ErrorAction SilentlyContinue).PSObject.Properties.Name -contains "URL Protocol") {
$name = $_.PSChildName
$count += 1
$line = "URI Handler {0:d4}: {1}" -f $count, $name
Write-Host $line
}
@hepcat72
hepcat72 / sendText.osa
Last active July 10, 2024 05:52
Send SMS or iMessages via AppleScript
#!/usr/bin/env osascript
-- Version 2, now with attachments!
-- Note, the first couple times you run this script, the Messages app may prompt you to approve a couple things, one of which will be the ability to send SMS messages through your phone
-- Run via osascript on the command line like this:
-- osascript sendText.scpt --to ########## "this is" "a text message" --attachment "/path/to/image.png" "sent via applescript"
-- Where ########## is the phone number to send to
-- If you leave out `--to ##########`, it defaults to the value of an environment variable named MYPHONE in your .bashrc file (add the line "export MYPHONE=##########" to ~/.bashrc, entering your default phone number in place of ##########)
-- The 3 quoted strings will appear on separate lines and the image will be inserted between the lines "a text message" and "sent via applescript"
on run argv
@MayerDaniel
MayerDaniel / server_user.md
Created September 5, 2022 21:34
Setting up a user on a server

Create new sudo user with home dir

sudo useradd -d /home/<user> -s /bin/bash -m <user>
sudo usermod -a -G sudo <user>

SSH key

sudo chown <user> -R /home/<user>/.ssh
sudo chmod 700 /home//.ssh