Skip to content

Instantly share code, notes, and snippets.

# Know the id of the username in the original distro that was exported
wsl -d Ubuntu-20.04 -u kartz -e id -u
# Outputs 1000
# Knowing the id of the username in the distro that was created by importing the tar image
wsl -d Ubuntu-20 -u kartz -e id -u
# Outputs 1000
# I would want to use this distroname and id, to set this user as the default login profile of WSL.
# I set this up in Windows Registry with the line snippet below:
@daniepetrov
daniepetrov / wsl2-network.ps1
Created August 6, 2020 15:41 — forked from daehahn/wsl2-network.ps1
WSL 2 TCP NETWORK FORWARDING
# WSL2 network port forwarding script v1
# for enable script, 'Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope CurrentUser' in Powershell,
# for delete exist rules and ports use 'delete' as parameter, for show ports use 'list' as parameter.
# written by Daehyuk Ahn, Aug-1-2020
# Display all portproxy information
If ($Args[0] -eq "list") {
netsh interface portproxy show v4tov4;
exit;
}
@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

@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 / 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
{
"title": "Language toggler",
"rules": [
{
"description": "Language toggler on SHIFTS",
"manipulators": [
{
"conditions": [
{
"type": "input_source_if",
@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
@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 / 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 / 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