Skip to content

Instantly share code, notes, and snippets.

View jtviegas's full-sized avatar

joao tiago viegas jtviegas

View GitHub Profile
<?xml version="1.0"?>
<ruleset name="Custom Rules"
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 https://pmd.sourceforge.net/ruleset_2_0_0.xsd">
<description>
custom static analysis rules
</description>
@echo off
SETLOCAL ENABLEDELAYEDEXPANSION
set this_script=%~f0
for %%F in ("%this_script%") do set script_folder=%%~dpF
set pwd=%cd%
if [%1]==[] goto usage
if [%2]==[] goto usage
@jtviegas
jtviegas / docker
Last active October 18, 2018 13:35
### run into container
docker run -it <image:version> bash
### attach to container
docker exec -it <image:version> bash
// /collection
// get
// 00_get_checkNumberOf_insert_checkNumberOf_delete_checkNumberOf
// post
// 10_post_getObj_checkEquals
// 11_post_not_valid_obj_422
// 12_post_not_existent_collectionId_404 (in case of nested collection)
// 13_post_to_conflic_or_constraint_409 (duplicate, etc...)
// put (upsert)
// 20_put_checkNumberOf_insert_getObj_checkEquals_checkNumberOf
@jtviegas
jtviegas / windows.txt
Last active January 25, 2018 11:21
windows tricks
# Find Process ID of process that uses a Port
netstat -aon | findstr 8080
# kill the process
Taskkill /PID 26356 /F
@jtviegas
jtviegas / git.md
Last active March 26, 2020 20:29
git tweaks

remove the file only from the Git repository and not remove it from the filesystem:

git rm --cached file1.txt
git commit -m "remove file1.txt"

connect local project to remote repository

git init
@jtviegas
jtviegas / basic.sh
Last active September 1, 2020 10:26
basic bash script
#!/bin/sh
this_folder="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
if [ -z "$this_folder" ]; then
this_folder=$(dirname $(readlink -f $0))
fi
parent_folder=$(dirname $this_folder)
# include file
if [ ! -f "$this_folder/variables.inc" ]; then
@jtviegas
jtviegas / basic.cmd
Last active January 15, 2018 12:52
basic windows script
@echo off
setlocal EnableDelayedExpansion
SET p=%~dp0
SET thisdir=%p:~0,-1%
FOR %%a IN ("%thisdir%") DO SET p=%%~dpa
set parentdir=%p:~0,-1%
echo %thisdir%
echo %parentdir%