Skip to content

Instantly share code, notes, and snippets.

View tolumide-ng's full-sized avatar

Tolumide Shopein tolumide-ng

  • Berlin, Germany
  • 09:04 (UTC +01:00)
View GitHub Profile
@tolumide-ng
tolumide-ng / index.txt
Last active March 8, 2024 22:04
Enable SAR on Ubuntu 20.x
1. # Open sysstat file
sudo vim /etc/default/sysstat
2. # Change the ENABLED="false" part to ENABLED="true" and save the changes
3. # Restart sysstat:
sudo service sysstat restart
4. ## To adjust the schedule the statistic is recorded run the command below, and update the activity report to your taste
sudo vim /etc/cron.d/sysstat
@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 / isObjectDifferent.js
Created March 19, 2021 10:57
Get the difference between two deeply nested Objects in javascript
// this comparison would not work for function and symbol comparisons
// this would only work best for compared objects that do not belong to same address in memory
// Returns true if there is no difference, and false otherwise
export const isObjNotSame = (obj1, obj2) => {
if (typeof obj1 !== "object" && obj1 !== obj2) {
return false;
}
if (typeof obj1 !== "object" && typeof obj2 !== "object" && obj1 === obj2) {
return true;
import * as React from "react";
export const DisplayProductsComponent = () =>< {
const {createScrollObserver, converge, setConverge} = useIntersectionObserver();
const [product, setProduct] = React.useState<ProductDef>(undefined);
const loadMoreRef = React.useRef<HTMLDivElement>(null);
let scrollObserver = createScrollObserver();
React.useEffect(() => {
// other conditions/cases
import * as React from "react";
interface entryDef {
isIntersecting: Boolean;
intersectionRatio: number;
}
interface IntersectionObserverDef {
ancestorElem?: Element,
}
import * as React from "react";
interface entryDef {
isIntersecting: Boolean;
intersectionRatio: number;
}
interface IntersectionObserverDef {
ancestorElem?: Element,
}
import * as React from "react";
interface entryDef {
isIntersecting: Boolean;
intersectionRatio: number;
}
interface IntersectionObserverDef {
ancestorElem?: Element,
}