Skip to content

Instantly share code, notes, and snippets.

@scriptingosx
scriptingosx / pkgAndNotarize.sh
Created September 10, 2019 12:46
Script that builds, packages and notarizes an Xcode command line tool.
#!/bin/zsh
# pkgAndNotarize.sh
# 2019 - Armin Briegel - Scripting OS X
# place a copy of this script in in the project folder
# when run it will build for installation,
# create a pkg from the product,
# upload the pkg for notarization and monitor the notarization status
@jeshan
jeshan / cdk-profile-plugin.js
Last active April 28, 2022 20:01
How to select AWS profiles per account in AWS CDK
const { CredentialProviderChain } = require('aws-sdk');
const AWS = require('aws-sdk');
const accountProvider = require('./account-provider');
let getEnv = function(accountId) {
// TODO: insert logic to get your desired profile name
return profileName;
};
let getProvider = async (accountId, mode) => {
@soundsnw
soundsnw / standard-user-access.sh
Created June 11, 2019 12:33
Give macOS standard users access to networking, printing and more
#!/bin/sh
#
# Provides standard user access to preference panels they would expect to be able to access, and might need access to.
#
# Provides standard users access to system preferences
/usr/bin/security authorizationdb write system.preferences allow
@vakila
vakila / SingleArrow.ipynb
Created April 12, 2019 07:23
Anjana Vakil, "The Universe in a Single Arrow", JSHeroes 2019
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@scriptingosx
scriptingosx / InstallerBuilds.sh
Created March 28, 2019 14:19
This script will print the build numbers of the macOS version from all installer apps
#!/bin/bash
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
installerBuildVersion() { # $1 path to the installer app
installerApp=${1:?"no path for installer"}
# echo "inspecting: $installerApp"
if [[ -d "$installerApp" ]]; then
identifier=$(/usr/libexec/PlistBuddy -c "print CFBundleIdentifier" "$installerApp/Contents/Info.plist")
@cellularmitosis
cellularmitosis / EmojiPointersDemo.swift
Created August 15, 2018 18:11
Representing pointer values as emoji can be useful for "visually" debugging certain issues, like cell reuse, etc.
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
let window = UIWindow(frame: UIScreen.main.bounds)
@WardsParadox
WardsParadox / chrome.mobileconfig
Created April 9, 2018 17:07
Newer style chromeconfig example for multi domain pattern sign-in whitelist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PayloadIdentifier</key>
<string>org.example.profile.chrome</string>
<key>PayloadRemovalDisallowed</key>
<true/>
<key>PayloadScope</key>
<string>System</string>
@miguelmota
miguelmota / ssm_parameter.go
Last active September 26, 2023 10:36
AWS SSM Go SDK parameter store example
package main
import (
"fmt"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/ssm"
)
@pudquick
pudquick / computer_icon.py
Created January 10, 2018 17:58
A variation on https://scriptingosx.com/2018/01/get-an-icon-for-your-mac/ that doesn't attempt to contact WindowServer / trigger errors
#!/usr/bin/python
from Foundation import NSZeroRect, NSMakeRect, NSMakeSize
from AppKit import NSPNGFileType, NSCompositeCopy, NSGraphicsContext, NSCalibratedRGBColorSpace, NSBitmapImageRep, NSImage, NSImageNameComputer
dimension = 512
size = NSMakeSize(dimension, dimension)
rect = NSMakeRect(0, 0, dimension, dimension)
image = NSImage.imageNamed_(NSImageNameComputer)
image.setSize_(size)
@groob
groob / pem.go
Created November 21, 2017 05:37
package main
import (
"fmt"
"log"
"os"
"github.com/groob/plist"
)