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 / server1.ps1
Created January 17, 2024 09:01
Alternative to launch PHP / Laravel webserver locally
param (
[int]$port = 8055
)
# Start the PHP built-in server on the specified port
# php -S "localhost:$port" -t public/
php artisan serve --host=localhost --port=${port}
@lcloss
lcloss / server.ps1
Created December 21, 2023 14:04
Start PHP server locally
# Start a PHP server
# Usage: server.ps1 [port]
# Example: server.ps1 8000
$port = 8000
if ($args.Length -gt 0) {
$port = $args[0]
}
$cmd = "php -S localhost:$port"
@lcloss
lcloss / elementor_sound_control.js
Created December 8, 2023 14:04
Elementor toggle sound button
<script>
document.addEventListener('DOMContentLoaded', function() {
var toggleSoundButtonMuted = document.querySelector('.e-fas-volume-mute');
var toggleSoundButtonSound = document.querySelector('.e-fas-volume-up');
toggleSoundButtonSound.style.display = "none";
var iconWrapper = toggleSoundButtonMuted.closest('.elementor-icon');
var secondIconWrapper = toggleSoundButtonSound.closest('.elementor-icon');
secondIconWrapper.removeChild(toggleSoundButtonSound);
var heroBackgroundVideo = document.querySelector('.herosection video');
@lcloss
lcloss / compressing.ps1
Last active July 20, 2023 08:36
Compressing and Extracting folders
#
# Uses 7Z to compress all $targetPath's subfolders.
#
# Example:
# root
# - HTML
# - Folder1
# - Folder2
# - Folder3
#
@lcloss
lcloss / OrgPhotos.ps1
Created July 20, 2023 08:35
Windows Shell script to organize photos in subfolders
#
# Description: Organize photos by date taken
#
# Example:
#
# From path where photos are, type:
#
# OrgPhotos
#
# > It will create subfolders grouped by Year and then by date, moving all
@lcloss
lcloss / .bashrc
Last active June 27, 2020 15:53
Bash
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
@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 "==================================================================="
@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 / 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 / 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.