Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Leo Dutra leodutra

🏠
Working from home
View GitHub Profile
@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 / a2dp.py
Created Aug 2, 2021 — forked from pylover/a2dp.py
Fixing bluetooth stereo headphone/headset problem in ubuntu 16.04, 16.10 and also debian jessie, with bluez5.
View a2dp.py
#! /usr/bin/env python3
"""Fixing bluetooth stereo headphone/headset problem in debian distros.
Workaround for bug: https://bugs.launchpad.net/ubuntu/+source/indicator-sound/+bug/1577197
Run it with python3.5 or higher after pairing/connecting the bluetooth stereo headphone.
This will be only fixes the bluez5 problem mentioned above .
Licence: Freeware
@leodutra
leodutra / headset-setup-bt.sh
Last active Aug 2, 2021
Bluetooth headset/ headphone Ubuntu 20.04 - tested with Sony WH-1000XM4 - shell script
View headset-setup-bt.sh
#!/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 Jul 24, 2021
Create array doing mapping sample
View create-mapping-sample.js
Array.from({ length: 130 }, (_, i) => (i + 2) * 5000).reverse()
@leodutra
leodutra / formatPrice.js
Last active Jul 24, 2021
Format price using Intl.NumberFormat
View formatPrice.js
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 — forked from kemitchell/-
npm license values
View - 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 — forked from nicktoumpelis/repo-rinse.sh
Cleans and resets a git repo and its submodules
View repo-rinse.sh
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 Jul 10, 2021
VSCode - Visual Studio Code settings
View settings.json
{
"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 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++) {
@leodutra
leodutra / .gitlfstracks
Created Dec 25, 2020 — forked from bdombro/.gitlfstracks
Git LFS Default Tracks - Common binary file extensions
View .gitlfstracks
"To include this, run `cat .gitlfstrack | xargs git lfs track`"
"*.3ds"
"*.3g2"
"*.3gp"
"*.7z"
"*.a"
"*.aac"
"*.adp"
"*.ai"
"*.aif"