Skip to content

Instantly share code, notes, and snippets.

@stefanopulze
stefanopulze / .htaccess.md
Created August 28, 2022 12:45
Awesome htaccess

Redirect if file or directory not exists

Options +SymLinksIfOwnerMatch 
RewriteEngine On 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
@stefanopulze
stefanopulze / ecdsa.sh
Created June 27, 2022 07:32
Self-Signed SSL Cert with ECDSA
# find your curve
openssl ecparam -list_curves
# generate a private key for a curve
openssl ecparam -name prime256v1 -genkey -noout -out private-key.pem
# generate corresponding public key
openssl ec -in private-key.pem -pubout -out public-key.pem
# optional: create a self-signed certificate
xdebug.mode = debug
xdebug.client_host = localhost
xdebug.client_port = 9003
xdebug.idekey = PHPSTORM
@stefanopulze
stefanopulze / nfs-linux.md
Created December 4, 2021 16:59
awesome nfs

Show mount points

showmount --exports <ip>

Mount

mount <ip>:<mount_point> <dest_folder>

# example
@stefanopulze
stefanopulze / Dockerfile
Created November 27, 2021 12:18
Docker timezone
FROM ubuntu:latest
ENV TZ=America/Los_Angeles
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

Linux ACL

Get information

getfacl /<folder>

Setting an ACL

setfacl [option] [action/specification] file
@stefanopulze
stefanopulze / config
Created March 27, 2021 12:38
~/.ssh/config
Host *
IdentityFile ~/.ssh/id_rsa
AddKeysToAgent yes
@stefanopulze
stefanopulze / git.sh
Last active July 31, 2020 07:01
How to remove files already added to git after you update .gitignore
# Update your .gitignore then
git rm -r --cached .
git add .
git commit -m "removed useless files"
@stefanopulze
stefanopulze / terminal.sh
Created July 29, 2020 07:31
Iso to usb with MacOS
// Open Terminal
diskutil list // Show all disk and find your usb
diskutil umount /dev/disk2 // Use your usb mount point
sudo dd if=/path/of/iso.iso of=/dev/disk2 bs=1m
@stefanopulze
stefanopulze / docker-101.sh
Last active July 20, 2021 07:58
Docker 101
# Remove all dangling images
docker rmi $(docker images -f "dangling=true" -q)
# Filter by tag
docker images -f "author=stefano"
# List docker volume files
docker run --rm -i -v=vol-name:/tmp/myvolume busybox find /tmp/myvolume