Skip to content

Instantly share code, notes, and snippets.

Uilian Souza uilian

Block or report user

Report or block uilian

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View acrnms.txt
AFAIK =» As Far As I Know
AFK =» Away From Keyboard
ASAP =» As Soon As Possible
BAS =» Big A$$ Smile
BBL =» Be Back Later
@uilian
uilian / replace-text-in-files.sh
Created May 15, 2019
Find all files containing some text, then replace by something else
View replace-text-in-files.sh
ag -l "TEXT_TO_FIND" . | xargs sed -i.bak 's/TEXT_TO_FIND/NEW_TEXT_TO_REPLACE/g'
@uilian
uilian / rename.sh
Created Apr 15, 2019
Multi-rename files
View rename.sh
# Assembles the old and new names, in the following example the name has 3 parts
# The NR adds a linenumber to the new name.
s ls pattern_file_name* | awk '{print "mv " $1"\\ "$2"\\ "$3" " $1 NR $3 }' | bash $1
@uilian
uilian / find-process.sh
Created Mar 26, 2019
Find process occupying port
View find-process.sh
## this
netstat -vanp tcp|grep PORT
## or this, if -p is not supported
lsof -i tcp:PORT
@uilian
uilian / docker-commands.md
Last active Jan 16, 2019
More docker commands
View docker-commands.md

Removes all containers returned by condition

docker container rm $(docker container ps -qa --filter "name=example1" --filter "name=example2")

Removes images older than specified 'ImageID' and not tagged

docker image rm $(docker images -q --filter "dangling=true" --filter "before=ImageID")
@uilian
uilian / diff-dirs.sh
Created Aug 7, 2018
Diff between two directories
View diff-dirs.sh
diff -r ~/projects/sim-api/ ~/projects/onboarding/sim-api/ | grep ~/projects/sim-api/ | awk '{print $4}' > difference.txt
@uilian
uilian / oracle-schema-objects-size.sql
Created Apr 26, 2018
Tamanho dos objetos em um schema oracle
View oracle-schema-objects-size.sql
-- Todos os objetos do schema
select
owner,
sum(bytes)/1024/1024/1024 schema_size_gig
from
dba_segments
group by
owner;
-- Tamanho por tipo de objeto
@uilian
uilian / docker-cleanup.sh
Created Jan 26, 2018
Remove unused docker objects
View docker-cleanup.sh
#remove stoped containers
docker rm $(docker ps -a -q)
# remove images without references
docker rmi $(docker images -f "dangling=true" -q)
# remove volumes without references
docker volume rm $(docker volume ls -qf dangling=true)
@uilian
uilian / docker-compose.yml
Created Jan 24, 2018
docker-compose nginx
View docker-compose.yml
version: '2'
services:
web:
image: nginx:stable-alpine
volumes:
- ./code:/usr/share/nginx/html
ports:
- "8080:80"
environment:
- NGINX_HOST=localhost.com
@uilian
uilian / python-server
Created Jan 23, 2018
Python as a HTTP server
View python-server
# Python has a HTTP server built into the
# standard library. This is super handy for
# previewing websites.
# Python 3.x
$ python3 -m http.server
# Python 2.x
$ python -m SimpleHTTPServer 8000
You can’t perform that action at this time.