Skip to content

Instantly share code, notes, and snippets.


Konrad Fedorczyk fedek6

View GitHub Profile
fedek6 /
Last active February 19, 2023 08:59
Automatic1111 instructions for low mem linux computers

Low mem automatic1111 setup for linux distros

Stop GDM to shake of some memory usage

This will give you 1GB extra vram on Pop!_OS. Use ctrl + alt + f3/f4 to switch between terminals.

sudo service gdm stop
fedek6 / converter.ts
Created January 17, 2023 10:04
Convert camel case object literal to snake case in TypeScript
View converter.ts
type CamelToSnake<T extends string, P extends string = ""> = string extends T
? string
: T extends `${infer C0}${infer R}`
? CamelToSnake<
`${P}${C0 extends Lowercase<C0> ? "" : "_"}${Lowercase<C0>}`
: P;
type CamelKeysToSnake<T> = {
fedek6 /
Created November 23, 2022 12:15
Fix "docker-compose docker: 'compose' is not a docker command"

Taken from: docker/for-mac#6569 (comment)

Looks like the fault could be a missing symlink between /usr/local/lib/docker/cli-plugins and /Applications/

Can you try manually creating this:

mkdir -p /usr/local/lib/docker
ln -s /Applications/ /usr/local/lib/docker/cli-plugins
fedek6 /
Created October 28, 2022 18:59
Disable macOS animations
defaults write -g NSAutomaticWindowAnimationsEnabled -bool false
defaults write -g NSScrollAnimationEnabled -bool false
defaults write -g NSWindowResizeTime -float 0.001
defaults write -g QLPanelAnimationDuration -float 0
defaults write -g NSScrollViewRubberbanding -bool false
defaults write -g NSDocumentRevisionsWindowTransformAnimation -bool false
defaults write -g NSToolbarFullScreenAnimationDuration -float 0
defaults write -g NSBrowserColumnAnimationSpeedMultiplier -float 0
defaults write autohide-time-modifier -float 0
defaults write autohide-delay -float 0
fedek6 / remove.bash
Created October 12, 2022 13:26
Remove a file from git history
View remove.bash
git log path_to_file
git filter-branch --index-filter "git rm -rf --cached --ignore-unmatch path_to_file" HEAD
fedek6 /
Created October 2, 2022 07:00
Fix keyboard not working on boot in PopOS
sudo kernelstub -a "quiet splash i8042.reset"
fedek6 / .editorconfig
Created May 24, 2022 12:36
Two spaces for everything
View .editorconfig
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
insert_final_newline = false
fedek6 /
Created May 13, 2022 08:37
React props naming conventions

Props naming

  • Array – use plural nouns. e.g. items
  • Number – use prefix num or postfix count, index etc that can imply a number. e.g. numItems, itemCount, itemIndex
  • Bool – use prefix is, can, has
    • is: for visual/behavior variations. e.g. isVisible, isEnable, isActive
    • can: fore behavior variations or conditional visual variations. e.g. canToggle, canExpand, canHaveCancelButton
    • has: for toggling UI elements. e.g. hasCancelButton, hasHeader
  • Object – use noun. e.g. item
  • Node – use prefix node. containerNode
fedek6 / auth-worker.js
Created April 21, 2022 11:47
Clooudflare worker for basic auth
View auth-worker.js
* @param {string} USERNAME User name to access the page
* @param {string} PASSWORD Password to access the page
* @param {string} REALM A name of an area (a page or a group of pages) to protect.
* Some browsers may show "Enter user name and password to access REALM"
const USERNAME = 'demouser'
const PASSWORD = 'demopassword'
const REALM = 'Secure Area'
fedek6 / gatsby-node.js
Created April 7, 2022 09:01
Better cache busting for Gatsby (using date hash)
View gatsby-node.js
const fs = require("fs");
const path = require("path");
const md5 = require("md5");
const util = require("util");
const glob = require("glob");
* Cache busting
const hash = md5(`${new Date().getTime()}`);