Skip to content

Instantly share code, notes, and snippets.

@gaearon
gaearon / Classes.js
Created May 27, 2020
Beneath Classes: Prototypes
View Classes.js
class Spiderman {
lookOut() {
alert('My Spider-Sense is tingling.');
}
}
let miles = new Spiderman();
miles.lookOut();
View awscreds-lpass.sh
#!/bin/sh
# Usage:
#
# - Install jq: https://stedolan.github.io/jq/
# - Add this script to your path, eg. to /usr/local/bin
# - Add AWS access key id and secret access key to LastPass
# named "AWS Credentials for my-profile profile"
# - Add "credential_process = awscreds-lpass my-profile" to
# the respective profile in ~/.aws/config
@tomhicks
tomhicks / plink-plonk.js
Last active Aug 5, 2020
Listen to your web pages
View plink-plonk.js
@talkingmoose
talkingmoose / Manage App Notifications.bash
Last active Aug 7, 2020
macOS Catalina will prompt users to allow Notifications from each app that makes a request. Administrators can manage these prompts using a Configuration Profile. If running Jamf Pro 10.19 or later, I suggest instead using this manifest: https://github.com/talkingmoose/jamf-manifests/blob/master/macOS%20Notifications%20(com.apple.notificationset…
View Manage App Notifications.bash
#!/bin/bash
<<ABOUT_THIS_SCRIPT
-----------------------------------------------------------------------
Written by:William Smith
Professional Services Engineer
Jamf
bill@talkingmoose.net
https://gist.github.com/talkingmoose/9faf50deaaefafa9a147e48ba39bb4b0
@scriptingosx
scriptingosx / pkgAndNotarize.sh
Created Sep 10, 2019
Script that builds, packages and notarizes an Xcode command line tool.
View pkgAndNotarize.sh
#!/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 Jul 26, 2020
How to select AWS profiles per account in AWS CDK
View cdk-profile-plugin.js
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 Jun 11, 2019
Give macOS standard users access to networking, printing and more
View standard-user-access.sh
#!/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 Apr 12, 2019
Anjana Vakil, "The Universe in a Single Arrow", JSHeroes 2019
View SingleArrow.ipynb
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 Mar 28, 2019
This script will print the build numbers of the macOS version from all installer apps
View InstallerBuilds.sh
#!/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 Aug 15, 2018
Representing pointer values as emoji can be useful for "visually" debugging certain issues, like cell reuse, etc.
View EmojiPointersDemo.swift
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)
You can’t perform that action at this time.