Skip to content

Instantly share code, notes, and snippets.

@shereshevsky
shereshevsky / iam-policy.json
Created July 14, 2020 12:57 — forked from quiver/iam-policy.json
How to connect to Amazon RDS PostgreSQL with IAM credentials
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"rds-db:connect"
],
"Resource": [
"arn:aws:rds-db:region:account-id:dbuser:dbi-resource-id/database-user-name"
@shereshevsky
shereshevsky / gist:1cce806fcfdba35228cefdf2f99e1d17
Created June 17, 2018 09:34
Prepare Python code for AWS Lambda function deployment
LAMBDA_HANDLER_FILE="main.py"
BUCKET="test-lambda-functions"
UUID=$(uuidgen)
PACKAGE_NAME="$UUID.zip"
ENV_NAME="$UUID"
virtualenv -p python3.6 /tmp/$ENV_NAME
. /tmp/$ENV_NAME/bin/activate
pip install -r requirments.txt
### Keybase proof
I hereby claim:
* I am shereshevsky on github.
* I am alsher (https://keybase.io/alsher) on keybase.
* I have a public key ASCG3bYITgraRHxw7Vm_YJ_lIpCETOEUKEOZG50Uq-5VZgo
To claim this, I am signing this object:
@shereshevsky
shereshevsky / gist:3812051
Created October 1, 2012 14:18
JavaScript: jQuery PubSub
(function($) {
var o = $( {} );
$.each({
on: 'subscribe',
trigger: 'publish',
off: 'unsubscribe'
}, function( key, api ) {
$[api] = function() {
o[key].apply( o, arguments );
@shereshevsky
shereshevsky / gist:3811940
Created October 1, 2012 13:57
CSS: Image Replacement
.ir {
border: 0;
font: 0/0 a;
text-shadow: none;
color: transparent;
background-color: transparent;
}
@shereshevsky
shereshevsky / gist:3811918
Created October 1, 2012 13:54
JavaScript: Sexy PubSub
// Works in modern browsers + IE9, but Modernizr has a polyfill baked in for function.bind.
// Hat tip Paul Irish
var o = $( {} );
$.subscribe = o.on.bind(o);
$.unsubscribe = o.off.bind(o);
$.publish = o.trigger.bind(o);
// Usage
$(document.body).on( 'click', function() {
@shereshevsky
shereshevsky / gist:3810526
Created October 1, 2012 09:24
HTML: Starting Template
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<title></title>
<link rel="stylesheet" href="style.css">
</head>
<body>