Skip to content

Instantly share code, notes, and snippets.

View sneycampos's full-sized avatar

Silvio Ney sneycampos

  • Portugal
  • 20:24 (UTC +01:00)
View GitHub Profile
@sneycampos
sneycampos / ps.alias.sh
Last active August 27, 2024 10:45
docker compose ps command retrieving only specific (useful) columns
alias ps='docker compose ps --format "table {{.Name}}\t{{.Image}}\t{{.Ports}}\t{{.State}}\t{{.Status}}"'
@sneycampos
sneycampos / compose.yml
Created June 19, 2024 23:32
zlmediakit running in docker with docker compose and NVIDIA GPU Capabilities
services:
zlmediakit:
image: zlmediakit/zlmediakit:master
deploy:
resources:
reservations:
devices:
- capabilities: [gpu]
environment:
- NVIDIA_VISIBLE_DEVICES=all
@sneycampos
sneycampos / zin_unzip_chunks.sh
Created November 1, 2023 23:44
zip and unzip in multiple chunks
zip -r -s 5G file.zip path/to/folder
cat file.z* > merged.zip
@sneycampos
sneycampos / unnacent.php
Last active August 17, 2023 09:26
PHP function to remove accents
<?php
$b = 'González';
function Unaccent($string)
{
return preg_replace('~&([a-z]{1,2})(acute|cedil|circ|grave|lig|orn|ring|slash|th|tilde|uml);~i', '$1', htmlentities($string, ENT_QUOTES, 'UTF-8'));
}
Unaccent($b);
@sneycampos
sneycampos / commands.md
Created April 12, 2023 12:05
docker images commands

pegar id da imagem

docker images -q ubuntu:latest

pega id das últimas imagens antes da latest (não inclui a última antes da latest, para fins de backup)

docker images -q --filter "before=ubuntu:latest" --format "{{.ID}}" | awk 'NR>1'
@sneycampos
sneycampos / docker-compose.yaml
Last active April 5, 2023 23:46
kiloview on docker-compose.yaml
version: '3.6'
services:
kiloview:
image: kiloview/klnkserver:latest
restart: always
ports:
- '82:82'
- '60000:60000/udp'
- '60001:60001/udp'
@sneycampos
sneycampos / gist:986a3974e0a3244a0b29984f4f600b76
Created April 13, 2021 16:52
ubuntu - delete folders created 20d ago
find . -maxdepth 1 -type d -mtime +20 -exec rm -rf {} \;
@sneycampos
sneycampos / Encryptable.php
Created April 9, 2021 19:31
trait Encryptable laravel
<?php
use Illuminate\Support\Facades\Crypt;
trait Encryptable
{
/**
* Decrypt the column value if it is in the encrypted array.
*
* @param $key
@sneycampos
sneycampos / Ubuntu New Installation.sh
Last active November 29, 2022 10:19
Ubuntu Install
# Terminator
## https://github.com/gnome-terminator/terminator
# unbind default terminal command
# gsettings set org.gnome.settings-daemon.plugins.media-keys terminal '[]'
# Go to Settings -> Devices -> Keyboard and scroll to the end. Press + and you will create custom shortcut.
# Enter name: "terminator", command: /usr/bin/terminator -l "layout-custom"
sudo add-apt-repository ppa:mattrose/terminator
@sneycampos
sneycampos / Docker useful commands
Last active February 2, 2021 22:55
Docker useful commands
## Docker
Find the container: docker ps -a
Delete container: docker rm -v <container_name>
List all images: docker image ls
Delete image by tag: docker image rmi _tag_ --force
Remove unused images: docker image prune --all --force
See space used by docker: docker system df
Remove dangling images: docker rmi $(docker images -f "dangling=true" -q) --force