Skip to content

Instantly share code, notes, and snippets.

View BolajiOlajide's full-sized avatar

Bolaji Olajide BolajiOlajide

View GitHub Profile
@BolajiOlajide
BolajiOlajide / column-print.py
Created August 31, 2017 12:40 — forked from alexland/column-print.py
printing formatted tables using python 3 "advanced string formatting"
# let's say you have four sequences you want to print columnwise, like so:
19 59 97 44
92 57 63 68
66 21 69 90
75 66 12 19
# mock some data
import random as RND
gen_row = lambda: [ RND.randint(10, 99) for c in range(3) ]
@BolajiOlajide
BolajiOlajide / ringtone-iphone.md
Created September 17, 2017 21:29
Create an iPhone ringtone from Youtube

Short summary:

Make the ringtone a less than 30 seconds long .m4r file (it is a renamed m4a file), put it in "Tones" in iTunes, and sync with the phone. Don't forget to enable sync'ing Tones when the phone is connected.

Instructions

Get the file as m4a audio

  1. Figure out the starting and ending time of the sound snippet by looking at the video in youtube.
  2. Get the youtube URL, i.e. http://youtube.com/watch?v=Rqz_JyAUZyg
@BolajiOlajide
BolajiOlajide / jwt_authentication.py
Created September 17, 2017 22:03 — forked from AndrewJHart/jwt_authentication.py
JWT authentication middleware for django rest framework that populates the request.user object
from django.utils.functional import SimpleLazyObject
from django.contrib.auth.models import AnonymousUser
from rest_framework.request import Request
from rest_framework_jwt.authentication import JSONWebTokenAuthentication
def get_user_jwt(request):
"""
Replacement for django session auth get_user & auth.get_user for
@BolajiOlajide
BolajiOlajide / config-editor.md
Created November 11, 2017 22:44 — forked from nnja/config-editor.md
Configure git editor

Set which editor git should use.

This is the program that will open during a commit with no -m flag, a merge, a rebase, etc...

Select from any installed editor. Examples:

  • emacs: emacs
  • vi: vi or vim
@BolajiOlajide
BolajiOlajide / MySQL_macOS_Sierra.md
Created January 23, 2018 23:40 — 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 :

@BolajiOlajide
BolajiOlajide / _readme.md
Created February 11, 2018 22:46 — forked from lambdahands/_readme.md
FlowType and CSS Modules

Huh?

So basically FlowType doesn't know about CSS Modules, a really handy way of dealing with the plagues of CSS in codebases (global variables and dependency wackiness mainly).

What WebPack allows us to do is "require" CSS files and use their class names:

import styles from "my_styles.css";
import React from "react";

#Setting up Nginx on Your Local System ###by Keith Rosenberg

##Step 1 - Homebrew The first thing to do, if you're on a Mac, is to install homebrew from http://mxcl.github.io/homebrew/

The command to type into terminal to install homebrew is:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
@BolajiOlajide
BolajiOlajide / introrx.md
Created March 2, 2018 00:02 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@BolajiOlajide
BolajiOlajide / firebase_detect_data.js
Created March 5, 2018 11:20 — forked from anantn/firebase_detect_data.js
Firebase: Detecting if data exists. This snippet detects if a user ID is already taken
function go() {
var userId = prompt('Username?', 'Guest');
checkIfUserExists(userId);
}
var USERS_LOCATION = 'https://SampleChat.firebaseIO-demo.com/users';
function userExistsCallback(userId, exists) {
if (exists) {
alert('user ' + userId + ' exists!');
@BolajiOlajide
BolajiOlajide / countries
Created September 16, 2018 02:03 — forked from kalinchernev/countries
Plain text list of countries
Afghanistan
Albania
Algeria
Andorra
Angola
Antigua & Deps
Argentina
Armenia
Australia
Austria