Skip to content

Instantly share code, notes, and snippets.

@app
app / objectArrayRecursiveSort.js
Last active January 17, 2025 10:26
Object array recursive sort gist
function mergeSort(arr) {
// Base case: if the array has 1 or 0 elements, it is already sorted
if (arr.length <= 1) {
return arr;
}
// Recursive case: divide the array into halves and sort each half
const mid = Math.floor(arr.length / 2);
const leftHalf = mergeSort(arr.slice(0, mid));
const rightHalf = mergeSort(arr.slice(mid));
@app
app / clean-dust-out.sh
Created February 16, 2022 18:04
Blow the dust out of your iMac with this simple script!
#!/bin/bash
# Works for iMac 5K late 2014 under Ubuntu 20.04
if [ "$(whoami)" != "root" ]
then
echo "Restart with root privelegies"
sudo su -s "$0"
exit
fi
T=10s
@app
app / gist:550b57b8688761708e0ef3f55604019f
Created September 6, 2021 06:54
#Docker container for #React, #JavaScript development
Alpine Linux Docker image ready for React/JavaScript development with git, neovim + plugins, tmux and current node.js
Intro in Russian https://youtu.be/YrBaoMfxjvA
Docker file https://github.com/app/indocker-dev-node-react/blob/alpine/Dockerfile
#!/bin/bash
# Have to be run in git project root folder
RU_ARRAY=($(find .|grep html$|sed s/"^.*\/"//|sort |uniq -u| sed 's/ /\n/g'))
for FILE in "${RU_ARRAY[@]}"
do
grep -Rn "$FILE" ./*|grep -v canonical|grep openbsd.org
done
@app
app / bcm57765or57785fix
Created June 22, 2018 14:08 — forked from samgooi4189/bcm57765or57785fix
Fixing Broadcom Corporation BCM57765/57785 SDXC/MMC Card Reader
Follow the WORKAROUND:
1. Add a comand to /etc/rc.local, add the following line above "exit 0":
setpci -s 00:1c.2 0x50.B=0x41
2. Add the same comand to /etc/apm/resume.d/21aspm (which does not exist yet):
setpci -s 00:1c.2 0x50.B=0x41
3. Add the following to /etc/modprobe.d/sdhci.conf:
options sdhci debug_quirks2=4
4. Re-generate initrd:
sudo update-initramfs -u -k all
5. Reboot or reload sdhci module:
@app
app / classSingleton
Created January 25, 2014 08:19
coffeescript Singleton class
# class
class Singleton
instance = undefined
title: null
setTitle: (title) ->
@title = title
getTitle: ->
@title