Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Lucas Saliés Brum sistematico

🎯
Focusing
View GitHub Profile
@sistematico
sistematico / colors.sh
Created Mar 25, 2021
Bash Prompt Colors
View colors.sh
txtblk='\e[0;30m' # Black - Regular
txtred='\e[0;31m' # Red
txtgrn='\e[0;32m' # Green
txtylw='\e[0;33m' # Yellow
txtblu='\e[0;34m' # Blue
txtpur='\e[0;35m' # Purple
txtcyn='\e[0;36m' # Cyan
txtwht='\e[0;37m' # White
bldblk='\e[1;30m' # Black - Bold
bldred='\e[1;31m' # Red
View keybase.md

Keybase proof

I hereby claim:

  • I am sistematico on github.
  • I am sistematico (https://keybase.io/sistematico) on keybase.
  • I have a public key whose fingerprint is 12E1 0A59 DB3D 541C AA98 DCBC 31BF 87E1 A576 43B2

To claim this, I am signing this object:

@sistematico
sistematico / stream_to_youtube.sh
Created Mar 3, 2021 — forked from olasd/stream_to_youtube.sh
Stream video to youtube via ffmpeg
View stream_to_youtube.sh
#! /bin/bash
#
# Diffusion youtube avec ffmpeg
# Configurer youtube avec une résolution 720p. La vidéo n'est pas scalée.
VBR="2500k" # Bitrate de la vidéo en sortie
FPS="30" # FPS de la vidéo en sortie
QUAL="medium" # Preset de qualité FFMPEG
YOUTUBE_URL="rtmp://a.rtmp.youtube.com/live2" # URL de base RTMP youtube
@sistematico
sistematico / youtube.php
Created Sep 10, 2020
youtube-dl with php
View youtube.php
<?php
// Original: https://stackoverflow.com/a/15156424/1844007
if (isset($_POST['url']) && filter_var($_POST['url'], FILTER_VALIDATE_URL) ) {
$url = filter_var($_POST['url'], FILTER_SANITIZE_URL);
$template = '/var/www/html/uploads/%(title)s.%(ext)s';
$string = ('youtube-dl ' . escapeshellarg($url) . ' --audio-format mp3 -o ' . escapeshellarg($template));
@sistematico
sistematico / kiwiirc-nginx.conf
Last active Sep 9, 2020 — forked from ItsOnlyBinary/kiwiirc-nginx.conf
Nginx + KiwiIRC Reverse Proxy
View kiwiirc-nginx.conf
server {
listen 80;
listen [::]:80;
server_name chat.site.com;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
listen [::]:443 ssl;
@sistematico
sistematico / directory.php
Created Sep 8, 2020
PHP Directory Iterator
View directory.php
<?php
// https://stackoverflow.com/a/25909955/1844007
// Construct the iterator
$it = new RecursiveDirectoryIterator("/components");
// Loop through files
foreach(new RecursiveIteratorIterator($it) as $file) {
if ($file->getExtension() == 'html') {
echo $file;
}
@sistematico
sistematico / validation-cpf.js
Created Aug 31, 2020 — forked from joaohcrangel/validation-cpf.js
Função para validar CPF
View validation-cpf.js
function isValidCPF(number) {
var sum;
var rest;
sum = 0;
if (number == "00000000000") return false;
for (i=1; i<=9; i++) sum = sum + parseInt(number.substring(i-1, i)) * (11 - i);
rest = (sum * 10) % 11;
if ((rest == 10) || (rest == 11)) rest = 0;
@sistematico
sistematico / timestamp.js
Created Aug 26, 2020
Convert Unix Timestamp to Date
View timestamp.js
let unix_timestamp = 1549312452;
let date = new Date(unix_timestamp * 1000);
let hours = "0" + date.getHours();
let minutes = "0" + date.getMinutes();
let seconds = "0" + date.getSeconds();
let days = "0" + date.getDate();
let months = "0" + date.getMonth();
let years = date.getFullYear();
let formattedTime = days.substr(-2) + '/' + months.substr(-2) + '/' + years + ' ' + hours.substr(-2) + ':' + minutes.substr(-2) + ':' + seconds.substr(-2);
console.log(formattedTime);
@sistematico
sistematico / navbar.js
Created Jul 10, 2020
Bulma Navbar Trigger
View navbar.js
document.addEventListener('DOMContentLoaded', () => {
// Get all "navbar-burger" elements
const $navbarBurgers = Array.prototype.slice.call(document.querySelectorAll('.navbar-burger'), 0);
// Check if there are any navbar burgers
if ($navbarBurgers.length > 0) {
// Add a click event on each of them
$navbarBurgers.forEach( el => {
@sistematico
sistematico / estados-cidades.json
Created Jul 1, 2020 — forked from letanure/estados-cidades.json
JSON estados cidades do brasil, dividido por estados. segunda lista atualizada em 2020, dados do IBGE
View estados-cidades.json
{
"estados": [
{
"sigla": "AC",
"nome": "Acre",
"cidades": [
"Acrelândia",
"Assis Brasil",
"Brasiléia",
"Bujari",