Skip to content

Instantly share code, notes, and snippets.

View tolumide-ng's full-sized avatar

Tolumide Shopein tolumide-ng

  • Ex-Andela
  • Berlin, Germany
  • 00:19 (UTC -12:00)
View GitHub Profile
@tolumide-ng
tolumide-ng / README.md
Created July 23, 2023 17:35 — forked from goliatone/README.md
Postgres TRIGGER to call NOTIFY with a JSON payload

This TRIGGER function calls PosgreSQL's NOTIFY command with a JSON payload. You can listen for these calls and then send the JSON payload to a message queue (like AMQP/RabbitMQ) or trigger other actions.

Create the trigger with notify_trigger.sql.

When declaring the trigger, supply the column names you want the JSON payload to contain as arguments to the function (see create_triggers.sql)

The payload returns a JSON object:

@tolumide-ng
tolumide-ng / README.md
Created January 9, 2023 19:30 — forked from lopspower/README.md
Hexadecimal color code for transparency

Hexadecimal color code for transparency

Twitter

How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

Download This sample on Google Play Store

@tolumide-ng
tolumide-ng / delete-likes-from-twitter.md
Created August 30, 2021 21:16 — forked from aymericbeaumet/delete-likes-from-twitter.md
[Recipe] Delete all your likes/favorites from Twitter

Ever wanted to delete all your likes/favorites from Twitter but only found broken/expensive tools? You are in the right place.

  1. Go to: https://twitter.com/{username}/likes
  2. Open the console and run the following JavaScript code:
setInterval(() => {
  for (const d of document.querySelectorAll('div[data-testid="unlike"]')) {
    d.click()
 }
@tolumide-ng
tolumide-ng / 77. Combinations (#1 Backtracking +DFS).java
Created May 15, 2021 20:27 — forked from yitonghe00/77. Combinations (#1 Backtracking +DFS).java
77. Combinations (https://leetcode.com/problems/combinations/description/): Given two integers n and k, return all possible combinations of k numbers out of 1 ... n.
// Backtracking + DFS solution
// Time: O(2 ^ n), 29ms
// Space: O(n) for there will be only n recursion calls (excluding result), 41.6mb
class Solution {
List<List<Integer>> ans;
public List<List<Integer>> combine(int n, int k) {
ans = new ArrayList<>();
combineR(n, k, 1, new ArrayList<>());
return ans;
}
@tolumide-ng
tolumide-ng / postgresql_mac.md
Created January 16, 2020 13:15
Postgresql on Mac

Installing

Reference

brew update
brew install postgresql
ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents
@tolumide-ng
tolumide-ng / jwt-expiration.md
Created January 2, 2020 10:07 — forked from soulmachine/jwt-expiration.md
How to deal with JWT expiration?

First of all, please note that token expiration and revoking are two different things.

  1. Expiration only happens for web apps, not for native mobile apps, because native apps never expire.
  2. Revoking only happens when (1) uses click the logout button on the website or native Apps;(2) users reset their passwords; (3) users revoke their tokens explicitly in the administration panel.

1. How to hadle JWT expiration

A JWT token that never expires is dangerous if the token is stolen then someone can always access the user's data.

Quoted from JWT RFC:

@tolumide-ng
tolumide-ng / Docker shell commands.sh
Created December 30, 2019 12:39 — forked from tomysmile/Docker shell commands.sh
A personal cheat sheet for running local Node project in a Docker container
# See list of docker virtual machines on the local box
$ docker-machine ls
NAME ACTIVE URL STATE URL SWARM DOCKER ERRORS
default * virtualbox Running tcp://192.168.99.100:2376 v1.9.1
# Note the host URL 192.168.99.100 - it will be used later!
# Build an image from current folder under given image name
$ docker build -t gleb/demo-app .
@tolumide-ng
tolumide-ng / nigeria-state-and-lgas.json
Created December 29, 2019 17:11 — forked from PaulOnyekwelu/nigeria-state-and-lgas.json
Nigeria States and LGAs in one JSON file
[
{
"state": "Adamawa",
"alias": "adamawa",
"lgas": [
"Demsa",
"Fufure",
"Ganye",
"Gayuk",
"Gombi",
@tolumide-ng
tolumide-ng / README.md
Created October 23, 2019 09:49 — forked from greyscaled/README.md
Sequelize + Express + Migrations + Seed Starter
@tolumide-ng
tolumide-ng / node_nginx_ssl.md
Created September 23, 2019 14:27 — forked from bradtraversy/node_nginx_ssl.md
Node app deploy with nginx & SSL

Node.js Deployment

Steps to deploy a Node.js app to Digital Ocean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt

1. Sign up for Digital Ocean

If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5424d440c63a

2. Create a droplet and log in via ssh

I will be using the root user, but would suggest creating a new user