Skip to content

Instantly share code, notes, and snippets.

View BolajiOlajide's full-sized avatar

Bolaji Olajide BolajiOlajide

View GitHub Profile
#!/bin/python3
"""
A Python script to delete tweets.
• It uses tweet ids from a Twitter archive to bypass the Twitter API limit. Use this script if you need to delete more
than 3200 tweets and what's in your archive is a tweets.csv file.
• If you have more than 3200 tweets but your archive has a tweets.json file use this:
https://gist.github.com/flesueur/bcb2d9185b64c5191915d860ad19f23f
@BolajiOlajide
BolajiOlajide / .storybook
Created November 26, 2019 22:24 — forked from romansorin/.storybook
Gatsby, TailwindCSS, Storybook configuration
- addons.js
- config.js
- webpack.config.js
@BolajiOlajide
BolajiOlajide / gist:d7ba403a0d19fcf48f40d1dda0ce4c4d
Created February 17, 2019 02:05 — 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 postgresql@9.6
brew unlink postgresql@9.6
brew link postgresql
@BolajiOlajide
BolajiOlajide / mysql_downgrade.txt
Created February 16, 2019 23:55 — forked from 6temes/mysql_downgrade.txt
Downgrade MySQL version with brew
# Kill rails server and guard
bin/spring stop
brew services stop mysql
brew uninstall mysql
brew install mysql@5.5
brew link mysql@5.5 --force
brew services start mysql@5.5
rbenv uninstall 2.3.3
rbenv install 2.3.3
gem install bundle
@BolajiOlajide
BolajiOlajide / bash.cheat
Created January 13, 2019 21:40 — forked from afair/bash.cheat
Bash Scripting Quick Reference
==========================================
BASH SCRIPTING ==========================================
========================================== TEST COMMAND
==========================================
Invoke: bash [options] file
Shebang: #!/usr/bin/env bash Test: test expression
In script: [ expression ]
========================================== Alternate: [[ espression ]]
LOOP Does not split string words
========================================== Does not expand pathglobs*
@BolajiOlajide
BolajiOlajide / caesarCipher.py
Created October 2, 2018 03:13 — forked from jameslyons/caesarCipher.py
Caesar Cipher Python
# we need 2 helper mappings, from letters to ints and the inverse
L2I = dict(zip("ABCDEFGHIJKLMNOPQRSTUVWXYZ",range(26)))
I2L = dict(zip(range(26),"ABCDEFGHIJKLMNOPQRSTUVWXYZ"))
key = 3
plaintext = "DEFEND THE EAST WALL OF THE CASTLE"
# encipher
ciphertext = ""
for c in plaintext.upper():
@BolajiOlajide
BolajiOlajide / rounding_decimals.md
Created September 17, 2018 22:55 — forked from jackiekazil/rounding_decimals.md
How do I round to 2 decimals in python?

How do I round to 2 decimals?

In python, you have floats and decimals that can be rounded. If you care about the accuracy of rounding, use decimal type. If you use floats, you will have issues with accuracy.

All the examples use demical types, except for the original value, which is automatically casted as a float.

To set the context of what we are working with, let's start with an original value.

Original Value

@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
@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 / introrx.md
Created March 2, 2018 00:02 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing