Skip to content

Instantly share code, notes, and snippets.

View uilian's full-sized avatar
🏠
Working from home

Uilian Souza uilian

🏠
Working from home
View GitHub Profile
@uilian
uilian / cowsay.sh
Created October 18, 2021 13:59
Custom cowsay script
#!/bin/bash
#
# see: http://blog.tomtung.com/2009/11/cowsay-fortune
# http://www.commandlinefu.com/commands/view/3584/remove-color-codes-special-characters-with-sed
# https://github.com/busyloop/lolcat
# https://github.com/dorentus/mruby-lolcat-bin
#
# requires `fortune`, `cowsay`,
# and ruby gem `lolcat` or its mruby version equivalent
@uilian
uilian / docker-compose-remote-java-debug.yml
Last active September 28, 2022 23:09
Remote Java Debug within Docker
version: '3.9'
services:
rdu:
image: your/image/here
ports:
- "50000:50000"
- "8443:8443"
- "49540:49540"
environment:
- "JAVA_OPTS=-agentlib:jdwp=transport=dt_socket,address=49540,server=y"

Test if a port on a remote system is reachable (without telnet)

From the man pages:

  • Single port:

    • nc -zv 127.0.0.1 80
  • Multiple ports:

    • nc -zv 127.0.0.1 22 80 8080
@uilian
uilian / latest-artifact.sh
Created June 25, 2021 21:41
Getting latest package from Artifactory
# https://blog.mimacom.com/artifactory-latest-version/
curl -s $(curl -s $(curl -s "$ARTIFACTORY_URL/$REPO_URL?lastModified" | jq -r '.uri') | jq -r '.downloadUri' )
# with basic auth and defining output directory
curl -u$ARTIFACTORY_USER:$ARTIFACTORY_TOKEN -O --output /tmp -s ...
@uilian
uilian / git-branches-by-commit-date.sh
Created May 6, 2021 14:48 — forked from jasonrudolph/git-branches-by-commit-date.sh
List remote Git branches and the last commit date for each branch. Sort by most recent commit date.
# Credit http://stackoverflow.com/a/2514279
for branch in `git branch -r | grep -v HEAD`;do echo -e `git show --format="%ci %cr" $branch | head -n 1` \\t$branch; done | sort -r
@uilian
uilian / rename-git-branch
Created May 5, 2021 12:26
Rename git branch local and remote
git checkout branch_to_be_renamed
git branch -m branch_to_be_renamed new_branch_name
git push origin --delete branch_to_be_renamed
git push origin -u new_branch_name
######
# -u, --set-upstream
# For every branch that is up to date or successfully pushed, add upstream (tracking)
# reference, used by argument-less git-pull(1) and other commands. For more information, see
# branch.<name>.merge in git-config(1).
@uilian
uilian / find-text-by-string.sh
Created July 30, 2020 14:15
Find line inside files matching string
grep -rnw . -e 'TEXT TO FIND'
@uilian
uilian / remove-brl.sh
Created July 14, 2020 21:40
Remove money formating
sed -r 's/\"(R\$\s*)([0-9]{0,})\.?([0-9]{0,})\.?([0-9]{1,})\.?([0-9]{0,3})\"/\2\3\4\5/g' input.json > output.json
@uilian
uilian / text-to-image.sh
Last active January 30, 2020 13:59
Export console text output to image
# text can be anything, 'ccow' below is an alias for:
# alias ccow='fortune | cowsay | lolcatjs'
convert
-size 500x500 \
xc:lightblue \
-font Courier -pointsize 12 \
-fill blue \
-gravity Northwest \
-draw "text 0,0 '$(ccow)'" \
image.png
@uilian
uilian / docker_debugging.md
Created January 29, 2020 12:28 — forked from veuncent/docker_debugging.md
Debugging Django apps running in Docker using ptvsd - Visual Studio (Code)

Remote debugging in Docker (for Django apps)

In order to enable debugging for your Django app running in a Docker container, follow these steps using Visual Studio (Code):

  1. Add ptvsd to your requirements.txt file
ptvsd == 4.3.2
  1. To your launch.json, add this: