Skip to content

Instantly share code, notes, and snippets.

View cozzbie's full-sized avatar
👻

Timi Aiyemo cozzbie

👻
  • Denmark
View GitHub Profile
@cozzbie
cozzbie / git.config.sh
Last active July 7, 2024 10:50
A Git Configuration
git config --global branch.autoSetupMerge always
git config --global --add --bool push.autoSetupRemote true
git config --global pull.rebase false
git config --global diff.colorMoved zebra
git config --global push.default simple
git config --global push.autosetupremote true
git config --global commit.gpgsign true
git config --global init.defaultBranch master
@cozzbie
cozzbie / error.out
Created November 18, 2022 18:31
Docker Provider Error
│ Error: Request cancelled
│ The plugin.(*GRPCProvider).ApplyResourceChange request was cancelled.
│ Error: Request cancelled
│ The plugin.(*GRPCProvider).ApplyResourceChange request was cancelled.
@cozzbie
cozzbie / .bashrc
Created February 8, 2021 01:23 — forked from vsouza/.bashrc
Golang setup in Mac OSX with HomeBrew. Set `GOPATH` and `GOROOT` variables in zshell, fish or bash.
# Set variables in .bashrc file
# don't forget to change your path correctly!
export GOPATH=$HOME/golang
export GOROOT=/usr/local/opt/go/libexec
export PATH=$PATH:$GOPATH/bin
export PATH=$PATH:$GOROOT/bin
@cozzbie
cozzbie / gist:59ffba00cb913623ba7febbfef177853
Created February 8, 2021 01:22
Install golang with homebrew
# Install golang with homebrew
brew install go --cross-compile-common
# Set following env variables in ~/.bashrc or ~/.zshrc
export GOPATH=$HOME/go
export GOROOT=/usr/local/opt/go/libexec
export GOBIN=$GOPATH/bin
export PATH=$PATH:$GOBIN
export PATH=$PATH:$GOROOT/bin
const body = document.querySelector('body');
const iframe = document.createElement('iframe');
iframe.src = `<link to sound>`;
iframe.allow = 'autoplay';
iframe.style.cssText = `display: none`;
body.appendChild(iframe);
// Definitly a better thing to do this is to have listeners
// on your sound instance.
setTimeout(() => {
@cozzbie
cozzbie / composing-software.md
Created March 7, 2020 14:13 — forked from Geoff-Ford/composing-software.md
Eric Elliott's Composing Software Series

Eric Elliott's "Composing Software" Series

A collection of links to the excellent "Composing Software" series of medium stories by Eric Elliott.

Edit: I see that each post in the series now has index, previous and next links. However, they don't follow a linear flow through all the articles with some pointing back to previous posts effectively locking you in a loop.

const countsort = (array, k) => {
const frequency = [...Array(k + 1).keys()].map(k => 0);
const out = [];
for(let j in array){
frequency[array[j]] = frequency[array[j]] + 1;
}
for(let i = 1; i < frequency.length; i++){
frequency[i] = frequency[i] + frequency[i - 1];
// https://en.wikipedia.org/wiki/Quicksort
// Divide and Conquer type.
// Worst Case (Rare): O(n**2)
// Typical: O(NlogN)
const swap = (array, x, y) => {
array[x] = [array[y], array[y] = array[x]][0];
};
const partition = (array, p, r) => {
const swap = (array, a, b) => {
let tempa = array[a];
array[a] = array[b];
array[b] = tempa;
}
const maxheap = (array, index) => {
const parenty = i => Math.ceil(i/2);
const lefty = i => 2*i;
const righty = i => 2*i + 1;
@cozzbie
cozzbie / insertsort.js
Created January 5, 2020 22:03
In-place insert sort.
const insertSort = array => {
for(let i = 1; i < array.length; i++) {
const el = array[i];
let j = i - 1;
while(j >= 0 && el < array[j]){
array[i--] = array[j];
array[j] = el;
j--;
}