Skip to content

Instantly share code, notes, and snippets.

Learning Plan for Design Patterns and Principles of Good Design

These learning resources primarily focus on programming using Good Design Principles and Design Patterns

  • There is an emphasis on learning using PHP, although most patterns are universal to every object orientated language.
@salerak
salerak / brew_commands.txt
Created November 13, 2019 16:25
Brew Commands
# Display the version of Homebrew.
$ brew --version
# Print Help Information
$ brew help
# Print Help Info for a brew command
$ brew help <sub-command>
# Check system for potential problems.
$ brew doctor
@salerak
salerak / happy_git_on_osx.md
Created October 30, 2019 15:14 — forked from trey/happy_git_on_osx.md
Creating a Happy Git Environment on OS X

Creating a Happy Git Environment on OS X

Step 1: Install Git

brew install git bash-completion

Configure things:

git config --global user.name "Your Name"

git config --global user.email "you@example.com"

@salerak
salerak / remove_future_maintenance_windows.py
Last active October 15, 2019 20:01 — forked from lfepp/remove_future_maintenance_windows.py
Script to remove all future maintenance windows from your PagerDuty account or your PagerDuty services - Modified for Python3
#!/usr/bin/env python
#
# Copyright (c) 2016, PagerDuty, Inc. <info@pagerduty.com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
@salerak
salerak / recurring_maintenance_windows.py
Created October 10, 2019 18:54 — forked from gripsiden/recurring_maintenance_windows.py
Script to create a number of recurring maintenance windows in PagerDuty - Adjusted for Python3
#!/usr/bin/env python
#
# Copyright (c) 2016, PagerDuty, Inc. <info@pagerduty.com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
@salerak
salerak / how-to-copy-aws-rds-to-local.md
Created March 25, 2019 14:59 — forked from syafiqfaiz/how-to-copy-aws-rds-to-local.md
How to copy production database on AWS RDS(postgresql) to local development database.
  1. Change your database RDS instance security group to allow your machine to access it.
    • Add your ip to the security group to acces the instance via Postgres.
  2. Make a copy of the database using pg_dump
    • $ pg_dump -h <public dns> -U <my username> -f <name of dump file .sql> <name of my database>
    • you will be asked for postgressql password.
    • a dump file(.sql) will be created
  3. Restore that dump file to your local database.
    • but you might need to drop the database and create it first
    • $ psql -U <postgresql username> -d <database name> -f <dump file that you want to restore>
  • the database is restored
SELECT * FROM pg_stat_activity WHERE datname = 'TransactionHistory' AND pid <> pg_backend_pid(); -- see currently active connections and their connections details
SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname = 'TransactionHistory' AND pid <> pg_backend_pid(); -- this will terminate all connections, but not your own connection
alter database "TransactionHistory" WITH ALLOW_CONNECTIONS false; -- this will disallow further connections
select pg_sleep(30); -- you can include this line to disallow connections for a given time, in seconds. i.e., if you need to block connections for 10 minutes you can use this: select pg_sleep(600)
alter database "TransactionHistory" WITH ALLOW_CONNECTIONS true; -- this will allow new connections