Skip to content

Instantly share code, notes, and snippets.

View fedek6's full-sized avatar
🎯
Focusing

Konrad Fedorczyk fedek6

🎯
Focusing
View GitHub Profile
@fedek6
fedek6 / profiler.sh
Created March 11, 2024 10:30
Bash profiler for app
#!/bin/bash
# Check if a PID was provided
if [ -z "$1" ]; then
echo "Usage: $0 <pid>"
exit 1
fi
PID=$1
OUTPUT_FILE="usage.txt"
@fedek6
fedek6 / unique_hex_string.php
Created September 11, 2023 07:49
Generate unique hex string in PHP
<?php
function generate_unique_hex_string($length) {
// Calculate the number of bytes needed for the desired length of the hexadecimal string
$byte_length = ceil($length / 2);
// Generate random bytes
$random_bytes = random_bytes($byte_length);
// Convert the random bytes to a hexadecimal string
$hex_string = bin2hex($random_bytes);
(function($, undefined){
/**
* acf
*
* description
*
* @date 14/12/17
* @since 5.6.5
*
@fedek6
fedek6 / Readme.md
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
fedek6 / converter.ts
Created January 17, 2023 10:04
Convert camel case object literal to snake case in TypeScript
type CamelToSnake<T extends string, P extends string = ""> = string extends T
? string
: T extends `${infer C0}${infer R}`
? CamelToSnake<
R,
`${P}${C0 extends Lowercase<C0> ? "" : "_"}${Lowercase<C0>}`
>
: P;
type CamelKeysToSnake<T> = {
@fedek6
fedek6 / readme.md
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/Docker.app/Contents/Resources/cli-plugins

Can you try manually creating this:

mkdir -p /usr/local/lib/docker
ln -s /Applications/Docker.app/Contents/Resources/cli-plugins /usr/local/lib/docker/cli-plugins
@fedek6
fedek6 / disable.sh
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 com.apple.dock autohide-time-modifier -float 0
defaults write com.apple.dock autohide-delay -float 0
@fedek6
fedek6 / remove.bash
Created October 12, 2022 13:26
Remove a file from git history
git log path_to_file
git filter-branch --index-filter "git rm -rf --cached --ignore-unmatch path_to_file" HEAD
@fedek6
fedek6 / fix-keyboard.sh
Created October 2, 2022 07:00
Fix keyboard not working on boot in PopOS
sudo kernelstub -a "quiet splash i8042.reset"
@fedek6
fedek6 / .editorconfig
Created May 24, 2022 12:36
Two spaces for everything
[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
insert_final_newline = false