Skip to content

Instantly share code, notes, and snippets.

View leodutra's full-sized avatar
🦙
Llama and other LLMs

Leo Dutra leodutra

🦙
Llama and other LLMs
View GitHub Profile
@leodutra
leodutra / headset-setup-bt.sh
Last active April 16, 2024 09:57
Bluetooth headset/ headphone Ubuntu 20.04 - tested with Sony WH-1000XM4 - shell script
#!/bin/sh
# sudo add-apt-repository ppa:eh5/pulseaudio-a2dp (NOT NEEDED ANYMORE)
sudo apt update
sudo apt install libldac \
libavcodec-extra58 \
pulseaudio \
pulseaudio-module-bluetooth \
blueman
@leodutra
leodutra / create-mapping-sample.js
Last active July 24, 2021 21:02
Create array doing mapping sample
Array.from({ length: 130 }, (_, i) => (i + 2) * 5000).reverse()
@leodutra
leodutra / formatPrice.js
Last active July 24, 2021 21:03
Format price using Intl.NumberFormat
const formatPrice = ({
price,
fraction = 2,
currency = 'USD',
currencyDisplay = 'symbol', // 'narrowSymbol' is not supported by Safari yet
locale = 'en-US',
signDisplay = 'auto',
...props
}) => {
if (isNaN(Number(price))) {
@leodutra
leodutra / - npm license values
Last active May 16, 2021 02:49 — forked from kemitchell/-
npm license values
74925 NONE
54706 MIT
9268 ISC
3050 BSD
1521 BSD-2-CLAUSE
791 APACHE-2.0
699 APACHE 2.0
392 BSD-3-CLAUSE
364 WTFPL
346 UNKNOWN
@leodutra
leodutra / repo-rinse.sh
Created May 7, 2021 06:41 — forked from nicktoumpelis/repo-rinse.sh
Cleans and resets a git repo and its submodules
git clean -xfd
git submodule foreach --recursive git clean -xfd
git reset --hard
git submodule foreach --recursive git reset --hard
git submodule update --init --recursive
@leodutra
leodutra / settings.json
Last active September 19, 2023 18:15
VSCode - Visual Studio Code settings
{
"editor.tabSize": 4,
"[javascript]": {
"editor.tabSize": 2,
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascriptreact]": {
"editor.tabSize": 2,
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
@leodutra
leodutra / replaceStrByRender.ts
Last active August 11, 2021 04:11
React - replace string by render or component
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++) {
@leodutra
leodutra / .gitlfstracks
Created December 25, 2020 22:01 — forked from bdombro/.gitlfstracks
Git LFS Default Tracks - Common binary file extensions
"To include this, run `cat .gitlfstrack | xargs git lfs track`"
"*.3ds"
"*.3g2"
"*.3gp"
"*.7z"
"*.a"
"*.aac"
"*.adp"
"*.ai"
"*.aif"
@leodutra
leodutra / git-delete-local-branches.sh
Last active April 17, 2024 16:17
Delete unused local branches ( Git )
#!/bin/sh
# 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 / leo-pulseeffects-preset.json
Last active April 2, 2020 05:16
Leo's PulseEffects preset (Sony MDR-7506)
{
"spectrum": {
"show": "true",
"n-points": "150",
"height": "100",
"use-custom-color": "true",
"fill": "true",
"show-bar-border": "true",
"scale": "1",
"exponent": "1",