Skip to content

Instantly share code, notes, and snippets.

Avatar
🎮

leandro cavalcante leandrocrs

🎮
View GitHub Profile
@leandrocrs
leandrocrs / reencode_to_mp4.sh
Created Nov 23, 2021
script to convert/encode a bunch of videos to mp4
View reencode_to_mp4.sh
#!/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
Promisefy child_process spawn in typescript
View promisefied-spawn.ts
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 Apr 7, 2021
react-input-mask + user-events + @testing-library/react
View react-input-mask_testing-library.ts
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 / setup.sh
Created Mar 31, 2021 — forked from jjvillavicencio/setup.sh
Install Android SDK on Windows Bash (WSL)
View setup.sh
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 / mobills - export transactions as csv.js
Last active Feb 8, 2021
mobills - exportar transações como CSV
View mobills - export transactions as csv.js
/**
* @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 / git_cleanup_non_remote_branches.sh
Created Jul 13, 2020
command to cleanup all local branch without remote
View git_cleanup_non_remote_branches.sh
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 / Fix-Phantasy-Star-Online-II.ps1
Created Jul 9, 2020
Fix Phantasy Star Online 2 Error 104
View Fix-Phantasy-Star-Online-II.ps1
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
View .zshrc
# 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
View Microsoft.PowerShell_profile.ps1
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 Jun 13, 2019 — forked from shanselman/profile.json
Windows Terminal Profile
View profile.json
{
"globals" :
{
"alwaysShowTabs" : true,
"defaultProfile" : "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
"initialCols" : 120,
"initialRows" : 30,
"keybindings" :
[
{