Skip to content

Instantly share code, notes, and snippets.

View cmaster11's full-sized avatar
๐Ÿ’
G'day!

Alberto Marchetti cmaster11

๐Ÿ’
G'day!
View GitHub Profile
@cmaster11
cmaster11 / display.swift
Created May 27, 2021 06:50
Simple script to set a display mode on MacOS
#!/usr/bin/env swift
// swiftc displaymode1.swift
import Foundation
import CoreGraphics
// Thanks to:
// https://gist.github.com/bellbind/27220148ea752335259dfce63f43bd5d
// https://stackoverflow.com/a/36299062/3671330
//
// Usage:
@cmaster11
cmaster11 / Markdium-YAML.yaml
Created April 30, 2021 16:09
Markdium-Track your infrastructure events with AWS SNS and Notify17
label: SNS catch-all
title: |
{{
default
(
printf
"SNS message - %s"
(last (splitList ":" .TopicArn))
)
.Subject
@cmaster11
cmaster11 / Markdium-Shell.bash
Created April 30, 2021 16:09
Markdium-Track your infrastructure events with AWS SNS and Notify17
aws sns publish \
--region us-east-1 \
--topic-arn "arn:aws:sns:us-east-1:123456789012:n17-example-aws-sns-test-hook-templated" \
--message "Hello!"
# Optionally you can also use
[--subject "Notification title"]
[--message-attributes '{"myKey1":{"DataType":"String","StringValue":"Mr. Anderson"}}']
#!/usr/bin/env bash
max="$1"
date
echo "url: $2
rate: $max calls / second"
START=$(date +%s);
get () {
response=$(curl --fail-with-body -v "$1" 2>&1)
if [[ $? -ne 0 ]]; then
@cmaster11
cmaster11 / Markdium-shell.sh
Created November 18, 2020 06:48
Markdium-Easy notifications from Bash scripts!
n17() { sh -c "$(wget -qO - "https://n17.io/sh")" -- -k "N17_RAW_API_KEY" "$@"; }
@cmaster11
cmaster11 / Markdium-shell.sh
Created November 18, 2020 06:48
Markdium-Easy notifications from Bash scripts!
mycommand; n17 -t "Script execution finished!"
@cmaster11
cmaster11 / Markdium-shell.sh
Created November 18, 2020 06:48
Markdium-Easy notifications from Bash scripts!
set -e
# Define the n17 function
n17() { sh -c "$(wget -qO - "https://n17.io/sh")" -- -k "N17_RAW_API_KEY" "$@"; }
# This function will be invoked on script error.
n17TrapErr() {
n17 \
-t "Script execution error!" \
-c "$(cat <
@cmaster11
cmaster11 / Markdium-shell.sh
Created November 18, 2020 06:48
Markdium-Easy notifications from Bash scripts!
And we'll get:
@cmaster11
cmaster11 / Markdium-shell.sh
Created November 18, 2020 06:47
Markdium-Easy notifications from Bash scripts!
mycommand; n17 -t "Script execution finished!"
@cmaster11
cmaster11 / Markdium-shell.sh
Created November 18, 2020 06:47
Markdium-Easy notifications from Bash scripts!
n17() { sh -c "$(wget -qO - "https://n17.io/sh")" -- -k "N17_RAW_API_KEY" "$@"; }