Skip to content

Instantly share code, notes, and snippets.

@daniepetrov
daniepetrov / gist:1fa5653e2206335073da40ff1ba406d6
Created November 6, 2019 07:58
One liner to stoOne liner to stop / remove all of Docker containers:p / remove all of Docker containers:
docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)
@daniepetrov
daniepetrov / index.js
Last active November 8, 2019 13:06
How to emulate <br> inside text box in React (the right way)
// Insert the text as you normally would, and fix the line breaks with CSS:
// Don't use dangerouslySetInnerHTML unless you really have to.
const title = "Don't use dangerouslySetInnerHTML \n unless you really \n have to."
const StyledTitle = styled('div')`
white-space: pre-wrap;
`
// And that way you get behavior like if you place <br>'s
@daniepetrov
daniepetrov / install yarn on wsl.sh
Last active November 25, 2019 13:16
Install yarn on Ubuntu wsl
sudo apt remove cmdtest
sudo apt remove yarn
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt update
sudo apt install yarn
@daniepetrov
daniepetrov / fix.md
Last active January 15, 2021 12:14
How to Fix Blurry Fonts in MacOS Mojave / Catalina for Non-Retina Displays
defaults write -g CGFontRenderingFontSmoothingDisabled -bool NO
defaults -currentHost write -globalDomain AppleFontSmoothing -int 1

Light font smoothing defaults command (my selection):

defaults -currentHost write -globalDomain AppleFontSmoothing -int 1
@daniepetrov
daniepetrov / OSX key bindings for window 10 with Autohotkey
Last active December 19, 2019 11:50
Autohotkey script for OSX like key bindings
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
SetCapsLockState, AlwaysOff
CapsLock & h::Send, {blind}{Left}
CapsLock & j::Send, {blind}{Down}
CapsLock & k::Send, {blind}{Up}
@daniepetrov
daniepetrov / script.sh
Last active January 17, 2020 13:35
Get the first frame of the video using ffmpeg library
# I've cobbled up this command line from various answers that works great for me to get the absolutely first frame out from a video.
# I use this to save a thumbnail screenshot for the video.
ffmpeg -i inputfile.mkv -vf "select=eq(n\,0)" -q:v 3 output_image.jpg
{
"title": "Language toggler",
"rules": [
{
"description": "Language toggler on SHIFTS",
"manipulators": [
{
"conditions": [
{
"type": "input_source_if",
@daniepetrov
daniepetrov / install.bash
Last active March 26, 2020 21:29
MacOS after install
1. First install homebrew
2. Install git via homebrew, because i don't like xcode command line tools only for git
3. Install zsh-nvm https://github.com/lukechilds/zsh-nvm
4. add ```export NVM_LAZY_LOAD=true``` to .zshrc before ```source ~/.zsh-nvm/zsh-nvm.plugin.zsh```
5. Install casks or apps
@daniepetrov
daniepetrov / forcergdb.txt
Created March 28, 2020 13:13
Instructions for Forcing RGB mode in Catalina
https://www.reddit.com/r/MacOS/comments/dkowz1/instructions_for_forcing_rgb_mode_in_catalina
Instructions for Forcing RGB mode in Catalina
This is basically a copy/paste from an Apple discussion thread, but there is one important step not mentioned in the thread. The original thread can be found here. You do not need to disable SIP for this. The monitor you want to use should be connected during this process.
Download this script: https://gist.github.com/adaugherity/7435890
@daniepetrov
daniepetrov / delay.md
Last active April 2, 2020 16:29
Mac dock delay and animation speed

Полностью убрать задержку при открытии dock: defaults write com.apple.Dock autohide-delay -float 0 && killall Dock

Увеличить скорость анимации появления dock defaults write com.apple.dock autohide-time-modifier -float 0.2;killall Dock

Добавить разделители в Dock:

defaults write com.apple.dock persistent-apps -array-add '{tile-data={}; tile-type="spacer-tile";}';killall Dock