Skip to content

Instantly share code, notes, and snippets.

View lcloss's full-sized avatar
🦊
Keep learning

Luciano Closs lcloss

🦊
Keep learning
View GitHub Profile
@lcloss
lcloss / estilo.css
Last active June 14, 2018 21:00
Curso Completo Web - Menu nav alinhado à direita
div.container {
padding-top: 60px;
padding-bottom: 60px;
}
.navbar-default {
background-color: rgba(250, 250, 250, 0.95);
color: #fff;
}
ul.navbar-nav li:hover {
background-color: rgb(240, 240, 240);
@lcloss
lcloss / .htaccess
Last active November 28, 2019 23:48
Example of a safer and more performative .htaccess
<IfModule mod_headers.c>
Header set Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" env=HTTPS
Header always set Content-Security-Policy "default-src 'self' *.cloudflare.com *.google-analytics.com; script-src 'self' 'unsafe-inline' 'unsafe-eval' *.cloudflare.com *.google-analytics.com https://sharebutton.net *.sharebutton.net; style-src 'self' 'unsafe-inline'; img-src data: *; object-src 'none'"
Header set X-Content-Type-Options nosniff
Header set X-Frame-Options DENY
Header set X-XSS-Protection "1; mode=block"
Header always set Referrer-Policy "same-origin"
Header always set Feature-Policy "microphone 'none'; payment 'none'; sync-xhr 'self' https://o-seu-dominio.com"
</IfModule>
@lcloss
lcloss / select.php
Last active December 5, 2018 02:47
Select com prepare + fetch
$sql = "SELECT userID, nome, apelido FROM usuarios WHERE userID = ?";
$user = $_SESSION['user_portal'];
if ($stmt = mysqli->prepare($sql)) {
mysqli_stmt_bind_param($stmt, "i", (int)$user);
/* execute query */
mysqli_stmt_execute($stmt);
/* bind result variables */
@lcloss
lcloss / install-docker.sh
Created January 10, 2019 21:30 — forked from dweldon/install-docker.sh
Install docker CE on Linux Mint 18.3
#!/usr/bin/env bash
# https://docs.docker.com/install/linux/docker-ce/ubuntu/
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable"
sudo apt-get update
sudo apt-get install docker-ce
# https://docs.docker.com/compose/install/
@lcloss
lcloss / DeleteEmptyFolders.vbs
Created March 16, 2019 19:59
CScript: Delete Empty Folders recursively
Option Explicit
' From: https://blogs.msdn.microsoft.com/jjameson/2009/11/03/deleting-empty-folders/
If (WScript.Arguments.Count <> 1) Then
WScript.Echo("Usage: cscript DeleteEmptyFolders.vbs {path}")
' If at least 1 argument is passed, list them
If (WScript.Arguments.Count > 0) Then
Dim strArg
@lcloss
lcloss / SyncFolders.vbs
Last active March 20, 2019 01:20
Windows Schell Script: Syncronize folders
Option Explicit
'
' Syncronize folders, in both ways, recursivelly
'
' Usage: cscript SyncFolders.vbs {source} {dest} [{logfile}] [/nolog] [/noecho] [/oneway] [/backup]
'
' {source} - Source path
' {dest} - Target path
' {logfile} - Log file. If not passed, "SyncFolders_YYYYMMDDHHMMSS.log" will be created.
@lcloss
lcloss / BackupFolders.vbs
Created March 16, 2019 23:07
CScript: Backup one folder to another (the first is the master)
Option Explicit
If (WScript.Arguments.Count <> 2) Then
WScript.Echo("Usage: cscript BackupFolders.vbs {source} {dest}")
' If at least 1 argument is passed, list them
If (WScript.Arguments.Count > 0) Then
Dim strArg
Dim i
@lcloss
lcloss / ListEmptyFolders.vbs
Created March 16, 2019 23:08
CScript: List Empty Folders recursivelly
Option Explicit
Dim objFSO
Set objFSO=CreateObject("Scripting.FileSystemObject")
If (WScript.Arguments.Count <> 2) Then
WScript.Echo("Usage: cscript ListEmptyFolders.vbs {path} {list file}")
' If at least 1 argument is passed, list them
If (WScript.Arguments.Count > 0) Then
@lcloss
lcloss / FindFileOrFolder.ps1
Created August 29, 2019 23:25
Search for a file or folder with PowerShell
Write-Output "Finding $($args[0])..."
Get-ChildItem –Path C:\ -Include $args[0] -Recurse -ErrorAction SilentlyContinue
@lcloss
lcloss / install-composer.sh
Created May 12, 2020 16:35
Install Composer on Linux, Ubuntu, etc.
#!/bin/bash
# Install Composer on Centos, Ubuntu, Debian
# Inspired by: https://gist.github.com/virbo/c3169ed490564f36f0c239d6fd16f749
user_allow="root"
if [ "$(whoami)" != $user_allow ]; then
echo "==================================================================="
echo " Falha na instalação. O composer deve ser instalado com o user: "$user_allow" ="
echo "==================================================================="