Skip to content

Instantly share code, notes, and snippets.

@mrgcohen
mrgcohen / MySQL_macOS_Sierra.md
Created August 13, 2019 21:04 — forked from nrollr/MySQL_macOS_Sierra.md
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 https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • 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
mrgcohen / aes.go
Created July 25, 2019 12:21 — forked from willshiao/aes.go
AES 256-CFB in Node.js, Go, and Python
package main
import (
"crypto/aes"
"crypto/cipher"
"crypto/rand"
"crypto/sha256"
"encoding/base64"
"fmt"
"io"
@mrgcohen
mrgcohen / multipart.swift
Created September 6, 2018 16:09 — forked from DejanEnspyra/multipart.swift
Alamofire 4 — Multipart file upload with Swift 3 (http://theappspace.com/multipart-file-upload/)
func requestWith(endUrl: String, imageData: Data?, parameters: [String : Any], onCompletion: ((JSON?) -> Void)? = nil, onError: ((Error?) -> Void)? = nil){
let url = "http://google.com" /* 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
mrgcohen / python_pymysql_notes.md
Created August 27, 2018 13:23 — forked from simonrw/python_pymysql_notes.md
Notes about pymysql connections

Database transactions

pymysql

  • Defaults to autocommit=False
connection = pymysql.connect(user='user', db='test')
cursor = connection.cursor()
cursor.execute('insert into test (value) values (10)')
@mrgcohen
mrgcohen / README.md
Created July 20, 2018 13:49 — forked from twolfson/README.md
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
mrgcohen / serverless.yml
Created March 30, 2018 15:15 — forked from DavidWells/serverless.yml
DynamoDB custom index serverless.yml example
service: service-name
provider:
name: aws
runtime: nodejs6.10
functions:
myfunc:
handler: handler.myfunc
/* @flow */
declare module 'dynamoose' {
declare type Throughput = number | ({
read: number;
} | {
write: number;
});
declare type ThroughputConfig = {
throuput: Throughput;
@mrgcohen
mrgcohen / yardoc_cheatsheet.md
Last active September 15, 2015 17:33 — forked from chetan/yardoc_cheatsheet.md
YARD cheatsheet

YARD CHEATSHEET http://yardoc.org

cribbed from http://pastebin.com/xgzeAmBn

Templates to remind you of the options and formatting for the different types of objects you might want to document using YARD.

Modules

Namespace for classes and modules that handle serving documentation over HTTP

# WINDOWS: Add domain user and put them in Domain Admins group
net user username password /ADD /DOMAIN
net group "Domain Admins" username /ADD /DOMAIN
# WINDOWS: Add local user and put them local Administrators group
net user username password /ADD
net localgroup Administrators username /ADD
# LINUX: Add a new user to linux and put them in the wheel group
useradd -G wheel username
<!DOCTYPE html>
<html>
<head>
<script src="background.js"></script>
</head>
<body>
<textarea id="sandbox"></textarea>
</body>