Skip to content

Instantly share code, notes, and snippets.

View hebertcisco's full-sized avatar
🎯
Focusing

Hebert F. Barros hebertcisco

🎯
Focusing
View GitHub Profile
@hebertcisco
hebertcisco / get-node.sh
Last active November 14, 2020 03:19
Install Node.js Unix
echo 'installing nvm'
curl -fsSL https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | sh
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt update && sudo apt install yarn node npm
sudo apt update && sudo apt install --no-install-recommends yarn
export PATH="$PATH:/opt/yarn-[version]/bin"
@hebertcisco
hebertcisco / kdenlive-gpu-rendenring.profile
Created October 21, 2020 00:40
Render by GPU (AMD) in Kdenlive
f=mp4 movflags=+faststart hwaccel_device=/dev/dri/renderD128 vf=‘format=nv12,hwupload’ c:v=h264_vaapi vcodec=h264_vaapi threads=2 preset=faster g=15 bf=2 vb=10M acodec=aac ab=256k
@hebertcisco
hebertcisco / sources.list
Created October 23, 2020 19:09
sources.list Ubuntu 20.10 Groovy Gorilla
#deb cdrom:[Ubuntu 20.10 _Groovy Gorilla_ - Release amd64 (20201022)]/ groovy main restricted
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://br.archive.ubuntu.com/ubuntu/ groovy main restricted
# deb-src http://br.archive.ubuntu.com/ubuntu/ groovy main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://br.archive.ubuntu.com/ubuntu/ groovy-updates main restricted
@hebertcisco
hebertcisco / chocolatey.ps1
Created October 24, 2020 15:04
Installing Chocolatey Windows
Set-ExecutionPolicy AllSigned
Set-ExecutionPolicy Bypass -Scope Process
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
choco -?
@hebertcisco
hebertcisco / install.sh
Created November 1, 2020 00:44
Ubuntu Installation Automation
#!/bin/bash
## By Hebert F. Barros 2019
## Removing any apt ## crashes
sudo rm /var/lib/dpkg/lock-frontend ; sudo rm /var/cache/apt/archives/lock ;
sudo apt-get update
echo 'installing curl'
sudo apt install curl -y
@hebertcisco
hebertcisco / MultiplicaNumerosReais.js
Last active December 12, 2020 13:49
Crie um programa que multiplique dois números reais
function MultiplicaNumerosReais(num1, num2) {
return console.log(num1 * num2);
}
MultiplicaNumerosReais(2, 2);
@hebertcisco
hebertcisco / NovoPrecoDoProduto.js
Created December 12, 2020 14:05
Crie um programa que calcule um novo preço de um produto, com acréscimo de 20%
function NovoPrecoDoProduto(preco) {
var acrescimo = (20 / 100) * preco;
return console.log(preco + acrescimo);
}
NovoPrecoDoProduto(10);
@hebertcisco
hebertcisco / ArmazenandoJSON.js
Created April 10, 2021 22:06
Armazenando dados JSON
// Armazenando dados:
meuObj = {nome: "Hebert", idade: 19, cidade: "Gyn"};
meuJSON= JSON.stringify(meuObj );
localStorage.setItem("testJSON", meuJSON);
// Recuperando dados:
text = localStorage.getItem("testJSON");
obj = JSON.parse(text);
document.getElementById("demo").innerHTML = obj.name;
@hebertcisco
hebertcisco / getLastMonths.ts
Created December 4, 2021 13:43
Funtion to get the last months as string eg: 'jan'
export const getLastMonths = (many: number): string[] => {
const months = [];
const currentMonth = new Date().getMonth();
for (let i = 0; i < many; i++) {
months.push(
new Date(new Date().setMonth(currentMonth - i)).toLocaleString(
'default',
{ month: 'short' },
),
);
@hebertcisco
hebertcisco / dateFormat.ts
Created December 4, 2021 13:45
Date Formatting Using Intl
import Intl from 'intl';
import 'intl/locale-data/jsonp/pt-BR';
export const dateFormat = (value: number | Date | undefined) => {
if (value) {
const date = new Date(value);
return Intl.DateTimeFormat('pt-BR', {
year: 'numeric',
month: 'numeric',
day: 'numeric',