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 / 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 / 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 / dev.yml
Created April 14, 2023 23:52 — forked from maxkostinevich/dev.yml
Github Actions - Deploy Serverless Framework (AWS)
#
# Github Actions for Serverless Framework
#
# Create AWS_KEY and AWS_SECRET secrets in Github repository settings
# If you're using env.yml file, store its content as ENV Github secret
#
# Master branch will be deployed as DEV and every new tag starting with "v**" (e.g. v1.0, v1.2, v2.0, etc) will be deployed as PROD
#
# Learn more: https://maxkostinevich.com/blog/how-to-deploy-serverless-applications-using-github-actions/
#
@hebertcisco
hebertcisco / docker-start-list-of-containers.ps1
Created April 4, 2022 19:21
Start a list of docker containers with Powershell
#!/usr/bin/env pwsh
$Command = 'docker start'
$ContainerName = 'example', 'example2', 'example3'
foreach ($Container in $ContainerName) {
$Exec = $Command + ' ' + $Container
Invoke-Expression $Exec
}
Exit-PSSession
function getTimeRemaining(endtime) {
let time = Date.parse(endtime) - Date.parse(new Date().toDateString());
const THOUSAND = 1000;
const HOURS_IN_DAY = 24;
const MINUTES_IN_HOUR = 60;
const SECONDS_IN_MINUTE = MINUTES_IN_HOUR;
let seconds = Math.floor(time / THOUSAND % SECONDS_IN_MINUTE);
let minutes = Math.floor(
type TypeGetTimeRemaining = {
total: number;
days: number;
hours: number;
minutes: number;
seconds: number;
};
function getTimeRemaining(endtime: string): TypeGetTimeRemaining {
let time = Date.parse(endtime) - Date.parse(new Date().toDateString());
@hebertcisco
hebertcisco / sortNumbers.ts
Created March 25, 2022 13:47
Number ordering in JavaScript not working? Solved.
const seq = [11, 12, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1];
function sortNumbers(arrayOfNumbers: number[]) {
return arrayOfNumbers.sort((x, y) => x - y);
}
sortNumbers(seq);
#!/usr/bin/env pwsh
function Docker-Build() {
$AppName = Read-Host -Prompt "Enter the name of the application: "
$Executor = 'docker '
$ExecutorArgs = 'build -t'
$GetArgsFinal = Read-Host -Prompt "Build to production OR development?: "
$ArgsFinal = '--target ' + $GetArgsFinal + ' .'
$Command = $Executor + $ExecutorArgs + ' ' + $AppName + ' ' + $ArgsFinal
@hebertcisco
hebertcisco / node.js-macos.yml
Created December 22, 2021 16:57
MACOS Pipeline to build nodejs Aplications
name: Node.js CI on Darwin
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
jobs:
build:
@hebertcisco
hebertcisco / moneyFormat.ts
Created December 4, 2021 13:47
Formatting Money Using Intl
import Intl from 'intl';
import 'intl/locale-data/jsonp/pt-BR';
export const moneyFormat = (value: number) => {
return new Intl.NumberFormat('pt-BR', {
style: 'currency',
currency: 'BRL',
}).format(value);
};