Skip to content

Instantly share code, notes, and snippets.

Avatar
🍸
learning

Alan Berman thealanberman

🍸
learning
  • SF Bay Area
View GitHub Profile
@danharper
danharper / background.js
Last active Jun 24, 2021
Bare minimum Chrome extension to inject a JS file into the given page when you click on the browser action icon. The script then inserts a new div into the DOM.
View background.js
// this is the background code...
// listen for our browerAction to be clicked
chrome.browserAction.onClicked.addListener(function (tab) {
// for the current tab, inject the "inject.js" file & execute it
chrome.tabs.executeScript(tab.ib, {
file: 'inject.js'
});
});
@boneskull
boneskull / hook-line-and-syncer
Last active Aug 20, 2019
rsync stuff to a different directory on file changes (Mac OS X)
View hook-line-and-syncer
#!/bin/bash
# Get fswatch: brew install fswatch
EXCLUDES_FILE="/tmp/syncer-excludes.txt"
SOURCES=( "/path/to/folder/to/watch" )
EXCLUDES=(
"*.vmwarevm"
".DS_Store"
"Icon\r"
".dropbox"
@stevebowman
stevebowman / AWSLambdaSimpleSMS.js
Last active Feb 27, 2020
AWS Lambda Function to send an SMS message via the Twilio API
View AWSLambdaSimpleSMS.js
console.log('Loading event');
// Twilio Credentials
var accountSid = '';
var authToken = '';
var fromNumber = '';
var https = require('https');
var queryString = require('querystring');
View osx_security.txt
security find-certificate -c "Izenpe.com" -a -Z "/System/Library/Keychains/SystemRootCertificates.keychain"| grep SHA-1 | awk '{print $NF}'
sudo security delete-certificate -Z 30779E9315022E94856A3FF8BCF815B082F9AEFD -t "/System/Library/Keychains/SystemRootCertificates.keychain"
security find-certificate -c "certificatename" -a -Z | \
sudo awk '/SHA-1/{system("security delete-certificate -Z "$NF)}'
@sj26
sj26 / retry.sh
Created Dec 8, 2016
Bash retry function
View retry.sh
# Retry a command up to a specific numer of times until it exits successfully,
# with exponential back off.
#
# $ retry 5 echo Hello
# Hello
#
# $ retry 5 false
# Retry 1/5 exited 1, retrying in 1 seconds...
# Retry 2/5 exited 1, retrying in 2 seconds...
# Retry 3/5 exited 1, retrying in 4 seconds...
@smithclay
smithclay / index.js
Created Jun 16, 2017
"Hello World" AWS Lambda + Terraform Example
View index.js
// 'Hello World' nodejs6.10 runtime AWS Lambda function
exports.handler = (event, context, callback) => {
console.log('Hello, logs!');
callback(null, 'great success');
}