Skip to content

Instantly share code, notes, and snippets.

View leandrocrs's full-sized avatar

leandro cavalcante leandrocrs

View GitHub Profile
@leandrocrs
leandrocrs / setup.sh
Created March 31, 2021 21:38 — forked from jjvillavicencio/setup.sh
Install Android SDK on Windows Bash (WSL)
cd $HOME
sudo apt-get install -y unzip
wget https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip
unzip sdk-tools-linux-4333796.zip -d Android
rm sdk-tools-linux-4333796.zip
sudo apt-get install -y lib32z1 openjdk-8-jdk
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
export PATH=$PATH:$JAVA_HOME/bin
printf "\n\nexport JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64\nexport PATH=\$PATH:\$JAVA_HOME/bin" >> ~/.bashrc
cd Android/tools/bin
@leandrocrs
leandrocrs / git_cleanup_non_remote_branches.sh
Created July 13, 2020 19:31
command to cleanup all local branch without remote
git fetch --prune | git branch -r | awk '{print $1}' | egrep -v -f /dev/fd/0 <(git branch -vv | grep origin) | awk '{print $1}' | xargs git branch -D
@leandrocrs
leandrocrs / reencode_to_mp4.sh
Created November 23, 2021 01:31
script to convert/encode a bunch of videos to mp4
#!/bin/sh
ls * | parallel -j 4 -u -k ffmpeg-bar -y -i {} -threads 0 -c:v libx264 -crf 23 -c:a aac -map_metadata 0 "../output/{.}.mp4"
# for fullfile in ./*; do
# # do some stuff here with "$f"
# # remember to quote it or spaces may misbehave
# filename=$(basename -- "$fullfile")
# extension="${filename##*.}"
# filename="${filename%.*}"
@leandrocrs
leandrocrs / promisefied-spawn.ts
Last active May 4, 2021 14:14
Promisefy child_process spawn in typescript
import { spawn } from "child_process";
import { SpawnOptionsWithoutStdio } from "node:child_process";
export default function spawnAsync(
cmd: string,
args: string[] = [],
options: SpawnOptionsWithoutStdio = {}
) {
return new Promise<number>((resolve, reject) => {
const result = spawn(cmd, args, options);
@leandrocrs
leandrocrs / react-input-mask_testing-library.ts
Created April 7, 2021 22:06
react-input-mask + user-events + @testing-library/react
import userEvent from '@testing-library/user-event';
import TestUtils from 'react-dom/test-utils';
function changeInputMaskValue(element: HTMLInputElement, value: string) {
element.value = value;
element.selectionStart = element.selectionEnd = value.length;
TestUtils.Simulate.change(element);
};
it('example test', async () => {
@leandrocrs
leandrocrs / mobills - export transactions as csv.js
Last active February 8, 2021 12:20
mobills - exportar transações como CSV
/**
* @author Leandro Cavalcante (@leandrocrs)
* Copiar o trecho abaixo e colar no console do navegador, na página de transações
*/
(() => {
const result = $r.props.store
.getState()
.transactions.movimentacoes.filter((m) => m.conta != null)
.map((m) => {
return {
@leandrocrs
leandrocrs / Fix-Phantasy-Star-Online-II.ps1
Created July 9, 2020 01:29
Fix Phantasy Star Online 2 Error 104
cd 'C:\Program Files\ModifiableWindowsApps\pso2_bin\'
Get-Acl .\pso2launcher.exe | Set-Acl .\pso2.exe
Get-Acl .\edition.txt | Set-Acl .\otp_notice_na.rtf
# If you come from bash you might have to change your $PATH. # export PATH=$HOME/bin:/usr/local/bin:$PATH # Path to your oh-my-zsh installation. export ZSH="/home/leandrw/.oh-my-zsh" # Set name of the theme to load --- if set to "random", it will
Import-Module oh-my-posh
function elevate-process
{
$file, [string]$arguments = $args;
$psi = new-object System.Diagnostics.ProcessStartInfo $file;
$psi.Arguments = $arguments;
$psi.Verb = "runas";
$psi.WorkingDirectory = get-location;
[System.Diagnostics.Process]::Start($psi);
@leandrocrs
leandrocrs / profile.json
Last active June 13, 2019 05:45 — forked from shanselman/profile.json
Windows Terminal Profile
{
"globals" :
{
"alwaysShowTabs" : true,
"defaultProfile" : "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
"initialCols" : 120,
"initialRows" : 30,
"keybindings" :
[
{