Skip to content

Instantly share code, notes, and snippets.

@alber70g
alber70g / memoize.js
Created September 14, 2023 13:23
Memoize function and Logger Proxy
/**
* function to memoize calls to a function
*
* @param {(args) => any} fn function that is executed if the key is not found in the cache
* @param {(args) => string)} keyGenFn function that accepts arguments and returns a string to identify the key in the cache
* @param {{toCache: (args) => any, fromCache: (args) => any}} options custom functions to store and retrieve values from the cache
*/
function memoizeFn(fn, options = {}, keyGenFn = (args) => args.join(',')) {
this.cache = {};
const _cache = {
@alber70g
alber70g / shell-setup.ps1
Created March 12, 2023 13:38 — forked from mikepruett3/shell-setup.ps1
Packages to install via scoop, winget, choco, and other tools...
<#
.SYNOPSIS
Script to Initialize my custom powershell setup.
.DESCRIPTION
Script uses scoop
.NOTES
**NOTE** Will configure the Execution Policy for the "CurrentUser" to Unrestricted.
Author: Mike Pruett
Date: October 18th, 2018
@alber70g
alber70g / keyboardLayout.json
Created December 28, 2021 17:11 — forked from tdegrunt/keyboardLayout.json
Colemak VSCode keyboard layout
{
"layout": {
"id": "com.apple.keylayout.Colemak",
"localizedName": "Colemak",
"lang": "en"
},
"rawMapping": {
"KeyA": {
"value": "a",
"valueIsDeadKey": false,
@alber70g
alber70g / README.md
Last active November 3, 2023 19:33 — forked from ikus060/smx8fancontrol
Python script to edit the X8DTL-iF Registry to control fan speed.

smx8fancontrol on unraid

To change the fan speeds on a SuperMicro X8 board (I have X8DTL-iF) there's a tool smx8fancontrol

Now there's a few deps that are needed and it's a pain to install them on UnRaid. So far this has been my script to get it to run:

# https://www.ikus-soft.com/en/blog/2017-10-01-supermicro-x8-controle-ventilateur/
# install smx8fancontrol on unraid
# install nerd-pack and enable `python3` and `pip`
@alber70g
alber70g / README.md
Last active October 26, 2021 11:40
Wrap command and execute it in a target directory

Execute command in target directory

This will allow you to create aliases that take a command, and execute it in a target directory when that is available

Usage:

  1. download execute-in.sh and place it in your home dir
  2. make this file executable chmod +x execute-in.sh
  3. create an alias
@alber70g
alber70g / README.md
Last active June 25, 2020 11:10
Fix Github

Drag this link to your bookmark and click it on a repository page:

[Fix Github][1]

javascript:(function()%7B%5B".Header"%2C ".pagehead"%5D.map(h %3D> document.querySelector(h)).forEach(el %3D> el.classList.add("container-xl"))%7D)()

[1]:javascript:(function()%7B%5B".Header"%2C ".pagehead"%5D.map(h %3D> document.querySelector(h)).forEach(el %3D> el.classList.add("container-xl"))%7D)()

@alber70g
alber70g / selectmode.fish
Last active November 21, 2019 22:23
Execute command based on sunset sundawn
function selectmode --description "Select light or darkmode based on time"
set currentday (date +%j)
if test $currentday -gt "280" || test $currentday -lt "90"
set sundawn "0900"
set sunset "1700"
else
set sundawn "0600"
set sunset "2000"
end
#
# Git
#
function __sf_section_git_albert -d "Display the git branch and status in Alberts way"
# ------------------------------------------------------------------------------
# Configuration __fish_git_prompt
# ------------------------------------------------------------------------------
set -g __fish_git_prompt_showcolorhints 'yes'
@alber70g
alber70g / HNPopularityColors.user.js
Last active March 12, 2019 08:35
Popularity color indicator for Show HN for TamperMonkey
// ==UserScript==
// @name Show HN vote color identification
// @namespace gist.github.com/Alber70g
// @version 0.7
// @description HN votes colors (logarithmic)
// @author Alber70g
// @match https://news.ycombinator.com/*
// @require https://unpkg.com/[email protected]/chroma.js
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
@alber70g
alber70g / fuse.js
Last active March 26, 2018 10:28
Sample
const {
FuseBox,
JSONPlugin,
EnvPlugin,
QuantumPlugin,
} = require('fuse-box');
const { TypeHelper } = require('fuse-box-typechecker');
const typeHelper = TypeHelper({
tsConfig: './tsconfig.json',