Skip to content

Instantly share code, notes, and snippets.

Avatar
😀
I may be slow to respond.

Lucas Saliés Brum sistematico

😀
I may be slow to respond.
View GitHub Profile
@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",
@sistematico
sistematico / github.sh
Created May 19, 2020
Github automatic clone & pull
View github.sh
#!/usr/bin/env bash
#
# github - Script para receber automaticamente as mudanças feitas no Github
# LEMBRE-SE DE CONFIGURAR CORRETAMENTE SEU GIT SEM SENHA!!!
#
# Desenvolvido por Lucas Saliés Brum <lucas@archlinux.com.br>
#
# Sugestão de crontab:
# * * * * * sh -c "/usr/local/bin/github.sh" > /dev/null 2>&1
#
@sistematico
sistematico / README.md
Created Dec 23, 2019 — forked from eric1234/README.md
Protect page with simple password
View README.md

Purpose

Unauthorized access to a PHP page prompts the user for a password. Once the password is entered the original page will show.

Features

  • The access is recorded in the session so it only needs to be
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 ASDCBeInhaJletveY7V-E_v5cdhGnb0Q5rUh0pMm3abbjwo

To claim this, I am signing this object:

You can’t perform that action at this time.