Skip to content

Instantly share code, notes, and snippets.


joao tiago viegas jtviegas

  • Copenhagen
View GitHub Profile
shopt -s nullglob
# get this file with the following command:
# curl --output
this_folder="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
jtviegas /
Last active Dec 9, 2021
bash shell scripts include file with common functionality
shopt -s nullglob
local _r=0
which kubectl 1>/dev/null
if [ ! "$?" -eq "0" ] ; then err "please install kubectl" && return 1; fi
which az 1>/dev/null
jtviegas /
Last active Aug 25, 2020
java vm options

the vm

get the vm flags

-XX:+UnlockDiagnosticVMOptions -XX:+PrintFlagsFinal

check just in time compilation

levels: 1,2,3 (C1 compiler)

level: 4 (C2 compiler => native code) (not on 32 bit vm)


save compilation log in remote jvm

-XX:+UnlockDiagnosticVMOptions -XX:+LogCompilation


17 Principles of (Unix) Software Design:

  1. Rule of Modularity: Write simple parts connected by clean interfaces.
  2. Rule of Clarity: Clarity is better than cleverness.
  3. Rule of Composition: Design programs to be connected to other programs.
  4. Rule of Separation: Separate policy from mechanism; separate interfaces from engines.
  5. Rule of Simplicity: Design for simplicity; add complexity only where you must.
  6. Rule of Parsimony: Write a big program only when it is clear by demonstration that nothing else will do.
  7. Rule of Transparency: Design for visibility to make inspection and debugging easier.
  8. Rule of Robustness: Robustness is the child of transparency and simplicity.
  9. Rule of Representation: Fold knowledge into data so program logic can be stupid and robust.

ms sql server

blocking queries

SELECT TOP 10 r.session_id, r.plan_handle,      r.sql_handle, r.request_id,      r.start_time, r.status,      r.command, r.database_id,      
r.user_id, r.wait_type,      r.wait_time, r.last_wait_type,      r.wait_resource, r.total_elapsed_time,      r.cpu_time, r.transaction_isolation_level,      
r.row_count, st.text  
FROM sys.dm_exec_requests r  
    CROSS APPLY sys.dm_exec_sql_text(r.sql_handle) as st  
 WHERE r.blocking_session_id = 0 and r.session_id 

Keybase proof

I hereby claim:

  • I am jtviegas on github.
  • I am jtviegas ( on keybase.
  • I have a public key ASD7R6ci7rKBnaaCP7FiK2A7etJf89As4GoIYxtbo35kAwo

To claim this, I am signing this object:

View linux commands
# necessary git basic config - avoid unnecessary merges
git config pull.rebase true
# Check ports
# To list the TCP ports that are being listened on, and the name of each listener’s daemon and its PID, run the following command:
sudo netstat -plnt
# download a folder from a github project
svn export admin
View python
### get notebook tokens
> ipython
[1] : system("jupyter" "notebook" "list")
['Currently running servers:','http://localhost:8895/token=067470c5ddsadc54153ghfjd817d15b5d5f5341e56b0dsad78a :: /u/user/dir']
### istall on untrusted server
View maven pmd config
<!-- results in target/pmd.xml and target/site/pmd.html -->
View maven pmd ruleset
<?xml version="1.0"?>
<ruleset name="Custom Rules"
custom static analysis rules