Skip to content

Instantly share code, notes, and snippets.

View BolajiOlajide's full-sized avatar

Bolaji Olajide BolajiOlajide

View GitHub Profile
@BolajiOlajide
BolajiOlajide / compress_video
Created August 22, 2024 11:19 — forked from trvswgnr/compress_video
portable shell script to compress videos with ffmpeg
#!/bin/sh
print_usage() {
echo "usage: compress_video <input_file>"
echo "supported formats: mp4, webm, mkv, mov, avi, flv"
}
get_extension() {
f="${1##*/}"
case "$f" in
@BolajiOlajide
BolajiOlajide / abstract_class.kt
Last active August 6, 2024 00:16
abstract_class.kt
fun main() {
Repository.startFetch()
getResult(Repository.getCurrentState())
Repository.finishFetch()
getResult(Repository.getCurrentState())
Repository.error()
getResult(Repository.getCurrentState())
}
@BolajiOlajide
BolajiOlajide / enums.kt
Last active August 6, 2024 00:02
Enums and State in Kotlin
fun main() {
Repository.startFetch()
getResult(Repository.getCurrentState())
Repository.finishFetch()
getResult(Repository.getCurrentState())
Repository.error()
getResult(Repository.getCurrentState())
}
@BolajiOlajide
BolajiOlajide / oop_kotlin.kt
Last active August 5, 2024 23:52
OOP in Kotlin
/**
* You can edit, run, and share this code.
* play.kotlinlang.org
*/
fun main() {
val myCar = Car()
println(myCar.color)
println(myCar.model)
myCar.drive()
@BolajiOlajide
BolajiOlajide / learn_kotlin.kt
Last active July 31, 2024 01:17
learning kotlin synthax
/**
* You can edit, run, and share this code.
* play.kotlinlang.org
*/
fun main() {
val amount = 90
when (amount) {
in 1..10 -> println("in between one and ten")
!in 11..20 -> println("not in between 11 and 20")
@BolajiOlajide
BolajiOlajide / csv_strip_dupes.go
Created June 25, 2024 02:50
Remove duplicate emails from a csv and output the result to a new one.
package main
import (
"encoding/csv"
"fmt"
"os"
"strings"
)
func main() {
@BolajiOlajide
BolajiOlajide / gradient.js
Created October 26, 2023 12:59
svelte-paint-gradient.js
export function paint(context, t) {
const { width, height } = context.canvas;
const imageData = context.getImageData(0, 0, width, height);
for (let p = 0; p < imageData.data.length; p += 4) {
const i = p / 4;
const x = i % width;
const y = (i / width) >>> 0;
const red = 64 + (128 * x) / width + 64 * Math.sin(t / 1000);
@BolajiOlajide
BolajiOlajide / GettingStartedWithJetbrains.md
Created October 7, 2022 13:51
Things to know when switching to Jetbrains (especially from VSCode)

I recently started trying out GoLand for development, I've heard good things about the product from my colleagues at Sourcegraph. The one thing that caught my eye was the better intellisense it had. I decided to signup for a trial (even though we had a company license, I did this because I wanted to be sure I was going to use the IDE so I don't take up a seat).

One of things that first confused is that Cmd + P which I used to look for files in VSCode wasn't a thing in Jetbrain products.

Apparently, there's a VSCode keymap plugin for Jetbrains that can be used to remap your keys so it works like VSCode.

If you don't want to install the plugin, you can change the mapping yourself by navigating to Preferences > Keymap and search for “go to file” and update the mapping.

@BolajiOlajide
BolajiOlajide / aggregate.js
Created December 18, 2021 21:10
Delete your tweets from your account
const fs = require('fs');
const tweet_1 = require('./data/tweet.js');
const tweet_2 = require('./data/tweet-part1.js');
const totalTweets = [...tweet_1, ...tweet_2].map(({ tweet }) => ({
id: tweet.id_str,
createdAt: tweet.created_at
}));
@BolajiOlajide
BolajiOlajide / aggregator.js
Created August 16, 2021 01:57
2021 Delete Tweets Script using twitter's export tool
const fs = require('fs');
const tweet_1 = require('./data/tweet.js');
const tweet_2 = require('./data/tweet-part1.js');
const totalTweets = [...tweet_1, ...tweet_2].map(({ tweet }) => ({
id: tweet.id_str,
createdAt: tweet.created_at
}));