Skip to content

Instantly share code, notes, and snippets.

@ersinakinci
ersinakinci / migrate_from_aws_rds_mysql_to_heroku_postgres.md
Last active January 25, 2022 14:08
Migrating from AWS RDS MySQL to Heroku Postgres

Overview

  1. Expose your RDS instance to outside world.
  2. Use pgloader to copy over your MySQL db to a local Postgres instance on your development machine.
  3. Dump your local Postgres db.
  4. Use heroku pg:backups:restore to upload your Postgres db dump.

Steps

  1. Follow the basic instructions for preparing your AWS RDS instance for data export (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/MySQL.Procedural.Exporting.NonRDSRepl.html). The most important part is to make sure that you have all your security settings (e.g., VPC, subnet, db security group if applicable) set up to expose port 3306 to the outside world and have your db root username and password. If you've forgotten your db's root password, follow these instructions to reset it: https://aws.amazon.com/premiumsupport/knowledge-center/reset-master-user-password-rds/
@phatblat
phatblat / AppDelegate.swift
Last active June 21, 2024 03:59
Example of creating HKObserverQuery and enabling background delivery for multiple HKObjectType
@UIApplicationMain
final class AppDelegate: UIResponder, UIApplicationDelegate {
let healthKitManager = HealthKitManager()
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
if onboardingComplete {
healthKitManager.requestAccessWithCompletion() { success, error in
if success { print("HealthKit access granted") }
else { print("Error requesting access to HealthKit: \(error)") }
}
  1. Elixir
    1. History
      1. Erlang
      2. OTP (Open Telecom Platform)
      3. Web servers as a use-case
      4. Rise of multi-core computing
      5. Cheap memory opens door to immutability
      6. The Whats App story
    2. Inception
  2. First failed attempt (Functional + OOP)
@dfasolin
dfasolin / update-hosts.sh
Last active January 8, 2016 09:24
Automatically update local hosts file with hosts-file.net
#!/usr/bin/env sh
# Filename: update-hosts.sh
# Authors: George Lesica <george@lesica.com>
# Danilo Fasolin Salmazio <dfasolin@gmail.com>
# Description: Replaces the HOSTS file with a customized version (hosts-file.net) that blocks
# domains that serve ads and malicious software, creating a backup of the old
# file.
# Improvements: Add the partial file, a /etc/hosts_dev with some development hosts and creates
# a logfile
@tonycoco
tonycoco / controller_spec.rb
Last active May 25, 2023 06:04
The Greatest Hits of Rspec Testing: Volume 1
require "spec_helper"
describe ExampleController do
context "GET #index" do
let(:resources) { FactoryGirl.create_list(:resource) }
before do
get :index
end
@agnoster
agnoster / README.md
Last active April 6, 2024 22:35
My ZSH Theme

agnoster.zsh-theme

A ZSH theme optimized for people who use:

  • Solarized
  • Git
  • Unicode-compatible fonts and terminals (I use iTerm2 + Menlo)

For Mac users, I highly recommend iTerm 2 + Solarized Dark

@brandonb927
brandonb927 / osx-for-hackers.sh
Last active June 13, 2024 02:39
OSX for Hackers: Yosemite/El Capitan Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned.
#!/bin/sh
###
# SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer)
# For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos
###
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx
@bjhess
bjhess / st_cheat.txt
Created January 11, 2012 21:39
Sublime Text Cheatsheet
Navigation:
cmd-p Goto Anything ('@' for functions, ':' for line number)
cmd-r Function finder
ctl-g Goto line number
cmd-sft-p Command palette
cmd-sft-f Find in Files
cmd-opt-r Toggle regex when finding
cmd-opt-# Columns
ctr-# Switch columns
@cheenu
cheenu / netflix_api_sample_signed_request.rb
Last active November 2, 2022 06:22
How to generate an OAuth signature for the Netflix API using Ruby
## This gist is intended to provide a code example for the
# 'Making Signed Requests' section of the 'Authentication Overview' document.
# (http://developer.netflix.com/docs/Security).
#
# We are going to make a catalog request. The hardest part of
# it is figuring out how to generate the oauth_signature.
require 'cgi'
require 'base64'
require 'openssl'