Skip to content

Instantly share code, notes, and snippets.

View emelent's full-sized avatar

Roy Motloutsi emelent

View GitHub Profile
class Program
{
static class JsRuntime {
public static Task InvokeVoidAsync(string name, params object[] args){
Console.WriteLine($"Running the js function {name} with arguments [{string.Join(", ", args)}]");
return Task.CompletedTask;
}
}
class VariadicFunc<T>(Func<object[], T> func)
@emelent
emelent / pomodoro.bash
Last active October 10, 2023 06:46
Simple bash function to use pomodoro method with task-warrior
pomo_minutes=5
# I have a task that I never complete made which I use to track pomodoro breaks
# so, set one up yourself, get it's uuid and place that here
pomo_task_uuid=<pomodoro-task-uuid>
function pomo {
task_id=$1
minutes=25
@emelent
emelent / interfacesSample.kt
Created September 13, 2022 10:00
Kotlin interfaces and operator overloading
interface Donkey {
fun speak(speech: String)
}
fun interface ISpeechDevice {
operator fun invoke(speech: String)
}
class PrintDevice: ISpeechDevice {
override fun invoke(speech: String) {
@emelent
emelent / di.go
Created July 19, 2022 14:34
Simple Go dependency injection container
package main
import (
"fmt"
"reflect"
)
type DependencyBuilder func() interface{}
type Container struct {
@emelent
emelent / cvim.rc
Last active December 17, 2021 16:45
my cvim config
set nohud
set nosmoothscroll
set noautofocus " The opposite of autofocus; this setting stops
" sites from focusing on an input box when they load
set typelinkhints
let searchlimit = 30
let scrollstep = 70
let barposition = "bottom"
@emelent
emelent / prettierrc.toml
Created December 1, 2021 09:50
My typescript / js prettier config
# .prettierrc.toml
trailingComma = "es5"
tabWidth = 4
semi = false
singleQuote = true
bracketSameLine = false
arrowParens = "always"
@emelent
emelent / crc.js
Created November 1, 2019 13:01
Ripped some code off of http://www.sunshine2k.de/coding/javascript/crc/crc_js.html strictly for computing crc's
var UInt64 = (function () {
function UInt64(numOrUint64, lowVal) {
if (typeof numOrUint64 === 'number') {
this.highVal = numOrUint64 & 0xFFFFFFFF;
this.lowVal = lowVal & 0xFFFFFFFF;
}
else {
this.highVal = numOrUint64.highVal;
this.lowVal = numOrUint64.lowVal;
}
@emelent
emelent / bible_setup_instructions.sh
Created October 22, 2019 22:16
Run this in your terminal and it will greet you with a random bible verse every time you open it
curl -s https://gist.githubusercontent.com/emelent/166ea4ac4aa6266fd11da30cd07d89ef/raw/9640599f339d984c93684a793737af9b1f1bdc08/install_bible_verse.sh | sh
@emelent
emelent / install_bible_verse.sh
Last active October 23, 2019 06:32
Simple bible verse install script
#!/bin/bash
check=`grep "setup_bible_verses" .bashrc &> /dev/null`
if [ "$check" = "" ]; then
echo "Setting up .bashrc bible script..."
text=`curl -s https://gist.githubusercontent.com/emelent/6a18bb8015664877dc605baa40cd10d3/raw/23a54e5419db4c4db7bff43db196c6f3d0c6119c/setup_bible_verses.sh` &&
echo $text >> .bashrc &&
echo "\nGreat, your .bashrc is now setup for bible verses. 😁" ||
echo "Setup failed, make sure you're online then try again. 😕"
else
@emelent
emelent / setup_bible_verses.sh
Last active October 23, 2019 06:31
Just include this in your .bashrc setup to have a random Bible verse displayed each time you open the terminal when you're online
function setup_bible_verses {
test -f ~/.bible_verse.sh ||
curl https://gist.githubusercontent.com/emelent/e5fb3c0a9b1b8f7a28483341752407ab/raw/56d5e4c14b085015d10828fedf8ff8a579934621/bible_verse.sh > ~/.bible_verse.sh
source ~/.bible_verse.sh
}
setup_bible_verses