Skip to content

Instantly share code, notes, and snippets.

mrgcohen / deny-account-key-items.json
Created Sep 13, 2019
aws deny key account items
View deny-account-key-items.json
"Version": "2012-10-17",
"Statement": [
"Sid": "DenyAdminAccountAndBilling",
"Effect": "Deny",
"Action": [
telnet 11211
mrgcohen /
Created Aug 13, 2019 — forked from nrollr/
Install MySQL on Sierra using Homebrew

Install MySQL on macOS Sierra

This procedure explains how to install MySQL using Homebrew on macOS Sierra 10.12

Install Homebrew

  • Installing Homebrew is effortless, open Terminal and enter :
    $ /usr/bin/ruby -e "$(curl -fsSL"
  • Note: Homebrew will download and install Command Line Tools for Xcode 8.0 as part of the installation process.

Install MySQL

At this time of writing, Homebrew has MySQL version 5.7.15 as default formulae in its main repository :

mrgcohen / aes.go
Created Jul 25, 2019 — forked from willshiao/aes.go
AES 256-CFB in Node.js, Go, and Python
View aes.go
package main
import (
mrgcohen /
Last active Jul 17, 2019
Export db query to file through stdout postgres
psql -h host -U username dbname -c "copy (select * from table) TO STDOUT WITH CSV" >> data.csv
mrgcohen / multipart.swift
Created Sep 6, 2018 — forked from DejanEnspyra/multipart.swift
Alamofire 4 — Multipart file upload with Swift 3 (
View multipart.swift
func requestWith(endUrl: String, imageData: Data?, parameters: [String : Any], onCompletion: ((JSON?) -> Void)? = nil, onError: ((Error?) -> Void)? = nil){
let url = "" /* your API url */
let headers: HTTPHeaders = [
/* "Authorization": "your_access_token", in case you need authorization header */
"Content-type": "multipart/form-data"
Alamofire.upload(multipartFormData: { (multipartFormData) in
mrgcohen /
Created Aug 27, 2018 — forked from mindriot101/
Notes about pymysql connections

Database transactions


  • Defaults to autocommit=False
connection = pymysql.connect(user='user', db='test')
cursor = connection.cursor()
cursor.execute('insert into test (value) values (10)')
mrgcohen /
Created Jul 20, 2018 — forked from twolfson/
Audit logging via sequelize

We prefer to have audit logging in our services that leverage databases. It gives us clarity into sources of where ACL issues might originate as well as gives us a general timeline of activity in our application.

Audit logging is tedious to set up so this gist contains our latest iteration of audit logging support for a sequelize based service.

mrgcohen /
Last active Mar 25, 2021
Postgres to elasticsearch

Logstash Postgres to Elastic

input {
    jdbc {
        jdbc_connection_string => "jdbc:postgresql://"
        jdbc_user => "username"
        jdbc_password => "password"
        jdbc_driver_library => "/Users/user/JDBC/postgresql-42.2.2.jar"
        jdbc_driver_class => "org.postgresql.Driver"
        statement => 'SELECT id, first_name, last_name, email from users'
mrgcohen / serverless.yml
Created Mar 30, 2018 — forked from DavidWells/serverless.yml
DynamoDB custom index serverless.yml example
View serverless.yml
service: service-name
name: aws
runtime: nodejs6.10
handler: handler.myfunc