Skip to content

Instantly share code, notes, and snippets.

View bosunolanrewaju's full-sized avatar
😅
Dancing in the Rain

'Bosun Olanrewaju bosunolanrewaju

😅
Dancing in the Rain
View GitHub Profile
@bosunolanrewaju
bosunolanrewaju / gist:6a90e57faba7e75d719ba1871b57faaa
Created April 5, 2018 09:53 — forked from giannisp/gist:ebaca117ac9e44231421f04e7796d5ca
Upgrade PostgreSQL 9.6.5 to 10.0 using Homebrew (macOS)
After automatically updating Postgres to 10.0 via Homebrew, the pg_ctl start command didn't work.
The error was "The data directory was initialized by PostgreSQL version 9.6, which is not compatible with this version 10.0."
Database files have to be updated before starting the server, here are the steps that had to be followed:
# need to have both 9.6.x and latest 10.0 installed, and keep 10.0 as default
brew unlink postgresql
brew install [email protected]
brew unlink [email protected]
brew link postgresql
@bosunolanrewaju
bosunolanrewaju / aws-go+docker-setup.sh
Created March 29, 2018 14:49 — forked from 0sc/aws-go+docker-setup.sh
Setup script for golang, docker and docker-compose on Amazon Linux AMI 2017.09.0 (HVM) on EC2
#!bin/sh
# Update installed packages and package cache
sudo yum update -y
# make sure in the home folder
cd ~/
# Golang installation
@bosunolanrewaju
bosunolanrewaju / README.md
Created March 20, 2018 10:41 — forked from hofmannsven/README.md
My simply MySQL Command Line Cheatsheet
@bosunolanrewaju
bosunolanrewaju / node-on-ec2-port-80.md
Created September 11, 2017 11:12 — forked from kentbrew/node-on-ec2-port-80.md
How I Got Node.js Talking on EC2's Port 80

The Problem

Standard practices say no non-root process gets to talk to the Internet on a port less than 1024. How, then, could I get Node talking on port 80 on EC2? (I wanted it to go as fast as possible and use the smallest possible share of my teeny tiny little micro-instance's resources, so proxying through nginx or Apache seemed suboptimal.)

The temptingly easy but ultimately wrong solution:

Alter the port the script talks to from 8000 to 80:

}).listen(80);
@bosunolanrewaju
bosunolanrewaju / migrate_postgresql_database.md
Created May 11, 2017 20:35 — forked from olivierlacan/migrate_postgresql_database.md
How to migrate a Homebrew-installed PostgreSQL database to a new major version (9.3 to 9.4) on OS X

This guide assumes that you recently run brew upgrade postgresql and discovered to your dismay that you accidentally bumped from one major version to another: say 9.3.x to 9.4.x. Yes, that is a major version bump in PG land.

First let's check something.

brew info postgresql

The top of what gets printed as a result is the most important:

@bosunolanrewaju
bosunolanrewaju / test.retry.php
Last active May 9, 2022 17:21 — forked from mudge/test.retry.php
A retry function for PHP.
<?php
require_once dirname(__FILE__) . '/../lib/simpletest/autorun.php';
// Retries $f (A function) with arguments ($args as array)
// 3 ($retries) times after 10 secs $delay
// Usage:
// retry( 'function_name', array('arg1', 'arg2'), 15, 5 );
// #=> Retries function_name 5 times with arg1 and $arg2 as arguments at interval of 15 secs
function retry($f, $args = null, $delay = 10, $retries = 3)
{
@bosunolanrewaju
bosunolanrewaju / caesar.rb
Created November 3, 2016 15:19 — forked from matugm/caesar.rb
Caesar cipher using Ruby
ALPHABET_SIZE = 26
def caesar_cipher(string)
shiftyArray = []
charLine = string.chars.map(&:ord)
shift = 1
ALPHABET_SIZE.times do |shift|
shiftyArray << charLine.map do |c|
((c + shift) < 123 ? (c + shift) : (c + shift) - 26).chr
<?php
global $post;
$author_id=$post->post_author;
?>
<?php
/* You can also use one of these instead:
- nickname
- user_nicename
- display_name