Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Leo Dutra leodutra

🏠
Working from home
View GitHub Profile
@leodutra
leodutra / -setup-windows-wsl-devenv.md
Last active Oct 19, 2021
Install and Setup Windows Subsystem 2 for Linux, Hyper, ZSH + Oh My Zsh + Powerlevel9k + plugins, FNM + VSCode (+ext) and Nerd Font
View -setup-windows-wsl-devenv.md

Setup Windows Subsystem 2 for Linux

Windows Subsystem 2 for Linux, Hyper, ZSH + Oh My Zsh + Powerlevel9k + plugins, FNM + VSCode (+ext) and Nerd Font

To setup native Linux, see this gist

Preview

Requirements

@leodutra
leodutra / nw_oodle.bms
Created Oct 16, 2021 — forked from jessy-lua/nw_oodle.bms
New World oodle preset for QuickBMS
View nw_oodle.bms
# ZIP files example 0.4.11
# more info: http://www.pkware.com/documents/casestudies/APPNOTE.TXT
# note that with some archives like those created by Stuff-it on MacOSX is
# not possible to use this script because they are wrongly built, practically
# they set the comp_size and uncomp_size fields of the "Local file header" at
# 0 and they set them only in the relative "Central directory structure" which
# means that it's necesary to read this one first for extracting the files
# contained in the local header... senseless and stupid
# script for QuickBMS http://quickbms.aluigi.org
@leodutra
leodutra / git-delete-local-branches.sh
Last active Aug 28, 2021
Delete unused local branches ( Git )
View git-delete-local-branches.sh
#!/bin/sh
# Good ref: https://devconnected.com/how-to-clean-up-git-branches/
# lists branches that can be deleted/pruned on your local. An option --dry-run is needed
git remote prune origin --dry-run
# In order to clean up remote tracking branches,
# meaning deleting references to non-existing remote branches,
# use the “git remote prune” command and specify the remote name
git remote prune origin
@leodutra
leodutra / bitwise-hacks.js
Last active Aug 26, 2021
Fast Int Math + Bitwise Hacks For JavaScript
View bitwise-hacks.js
// http://michalbe.blogspot.com.br/2013/03/javascript-less-known-parts-bitwise.html
// http://jsperf.com/bitwise-vs-math-object
// http://united-coders.com/christian-harms/results-for-game-for-forfeits-and-the-winner-is/
// https://mudcu.be/journal/2011/11/bitwise-gems-and-other-optimizations/
// https://dreaminginjavascript.wordpress.com/2009/02/09/bitwise-byte-foolish/
// http://jsperf.com/math-min-max-vs-ternary-vs-if/24
"use strict";
var PI = Math.PI;
@leodutra
leodutra / what-is-installed.sh
Last active Aug 19, 2021
List details of installed software on Linux
View what-is-installed.sh
#http://askubuntu.com/questions/17823/how-to-list-all-installed-packages
apt --installed list
dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n
#dpkg --get-selections > ~/InstalledPackages.list
#or
dpkg --get-selections | grep -v deinstall
#To save that list to a text file called packages on your desktop do this in your terminal:
@leodutra
leodutra / enable-WSL2.ps1
Last active Aug 19, 2021
Enable Windows Subsystem Linux 2 ( WSL 2 )
View enable-WSL2.ps1
# AS ADMIN
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform
# Use this command to convert a distro to use the WSL 2 architecture or use the WSL 1 architecture.
# <Distro>: the specific Linux distro (e.g. “Ubuntu”)
# <Version>: 1 or 2 (for WSL 1 or 2)
# wsl --set-version <Distro> <Version>
# Changes the default install version (WSL 1 or 2) for new distributions.
@leodutra
leodutra / vscode-extensions.bat
Last active Aug 19, 2021
My Visual Studio Code Extensions for Windows and Linux (vscode ext)
View vscode-extensions.bat
call code --install-extension alefragnani.bookmarks
call code --install-extension amandeepmittal.pug
call code --install-extension amazonwebservices.aws-toolkit-vscode
call code --install-extension angular.ng-template
call code --install-extension bierner.markdown-preview-github-styles
call code --install-extension coenraads.bracket-pair-colorizer-2
call code --install-extension cweijan.vscode-office
call code --install-extension DavidAnson.vscode-markdownlint
call code --install-extension dbaeumer.vscode-eslint
call code --install-extension eamodio.gitlens
@leodutra
leodutra / ed_notes.md
Created Aug 16, 2021 — forked from corenting/ed_notes.md
Elite: Dangerous APIs findings
View ed_notes.md
@leodutra
leodutra / -setup-linux-devenv.md
Last active Aug 16, 2021
Install and Setup Ubuntu Linux dev env with Terminator, ZSH (+ .zshrc) + Oh My Zsh + Powerlevel9k + plugins, Rust, FNM + VSCode (+ext) and Nerd Font
View -setup-linux-devenv.md

Setup Ubuntu Linux Dev Environment

Terminator, ZSH (+ .zshrc) + Oh My Zsh + Powerlevel9k + plugins, Rust, FNM + VSCode (+ext) and Nerd Font

To setup Linux for WSL2, see this gist

Preview

Requirements

@leodutra
leodutra / replaceStrByRender.ts
Last active Aug 11, 2021
React - replace string by render or component
View replaceStrByRender.ts
const replaceStrByRender = (
str: string,
substr: string | RegExp,
render: (part: string, i: number) => JSX.Element
) => {
if (!str || !substr) return str
const parts = str.split(substr)
const results: Array<string | JSX.Element | null> = []
let index = 0
for (let i = 0; i < parts.length; i++) {