Skip to content

Instantly share code, notes, and snippets.

mrmichalis /
Last active May 27, 2020
HTTPS Client in JAVA
cat << EOF >
// purpose; connecto to an HTTPS site and display certificate chain, validity, owner, issuer, SNI
import java.util.*;
watch --difference=cummulative --interval=1 '(echo device read_IOs read_merges read_sectors read_ticks write_IOs write_merges write_sectors write_ticks in_flight io_ticks time_in_queue; for file in /sys/block/*/stat; do echo -n $file; cat $file; done) | column -t'
#device read_IOs read_merges read_sectors read_ticks write_IOs write_merges write_sectors write_ticks in_flight io_ticks time_in_queue
#/sys/block/dm-0/stat 116962 0 2212746 314096 7705653 0 150218536 609670232 0 644428 610921004
#/sys/block/dm-1/stat 116479 0 2208882 313324 7686986 0 150218536 609676068 0 644616 611418072
#/sys/block/dm-2/stat 302 0 2416 780 0 0 0 0 0 148 780
#/sys/block/sda/stat 91181 26273 2217246 74876 7314854 388030 150261802 16954364
mrmichalis /
Last active Mar 26, 2021
Take thread dumps from a JVM

How can I take thread dumps from a JVM on UNIX or Windows?

A thread dump is a list of all the Java threads that are currently active in a Java Virtual Machine (JVM).

There are several ways to take thread dumps from a JVM. It is highly recommended to take more than 1 thread dump. A good practice is to take 10 thread dumps at a regular interval (for example, one thread dump every ten seconds).

Step 1: Get the PID of your Java process

The first piece of information you will need to be able to obtain a thread dump is your Java process's PID.

The Java JDK ships with the jps command which lists all Java process ids. You can run this command like this:

mrmichalis /
Created Jan 9, 2018 — forked from meatcar/
These notes should help you undestand Avro, and give you an entrypoint to start understanding the ga4gh API.

What is Avro?

Parsing the ga4gh API requires you first to understand what is Avro.

Avro is a project that allows you to

  • formaly declare and define data structures (schemas in Avro) to be later used in different languages.
  • store data in a file
  • fetch data from a file
View OpenSSL

OpenSSL Cheatsheet

Generating Certificates

Generate RSA Private Key + CSR
openssl req -out newkey.csr -new -newkey rsa:[bits] -nodes -keyout priv.key

Generate Self Signed Certificate + Priv Key
openssl req -x509 -sha256 -nodes -days 365 -newkey rsa:[bits] -keyout priv.key -out cert.crt

mrmichalis /
Created Dec 13, 2017 — forked from glennschler/
AWS Docker VPN

Using AWS Linux setup an L2TP/IPSEC Soft Ether VPN

Consider HVM (SSD) EBS-Backed 64-bit m3.medium

  • us-east-1 => ami-1ecae776

  • Updates and dependencies

sudo yum -y update
sudo yum -y upgrade
sudo yum -y install docker git wget
mrmichalis /
Created Nov 24, 2017 — forked from nateware/
Check local files vs what's on S3, and upload any that have changed.
#!/usr/bin/env python
# Compare a file on S3 to see if we have the latest version
# If not, upload it and invalidate CloudFront
import fnmatch
import os
import boto
import pprint
import re
mrmichalis / LICENSE.txt
Created Aug 18, 2017 — forked from kevinoid/LICENSE.txt
An example program using AsyncHttpClient with SSL certificate verification
View LICENSE.txt
CC0 1.0 Universal
Statement of Purpose
The laws of most jurisdictions throughout the world automatically confer
exclusive Copyright and Related Rights (defined below) upon the creator and
subsequent owner(s) (each and all, an "owner") of an original work of
authorship and/or a database (each, a "Work").
Certain owners wish to permanently relinquish those rights to a Work for the
mrmichalis /
Created May 12, 2017
Connect to Cloudera Manager Agent supervisord via xmlrpclib
# grep -A2 username /var/run/cloudera-scm-agent/supervisor/supervisord.conf | head -2
# ...
# username=6898309654436388381
# password=7733585661005351423
# ...
import xmlrpclib
server = xmlrpclib.Server('http://6898309654436388381:7733585661005351423@localhost:19001/RPC2')
# so that Ctrl-V works
alias xclip='xclip -selection c'
# this is from website, with small adjustment near the end
transfer() {
if [ $# -eq 0 ]; then
echo "No arguments specified. Usage:\necho transfer /tmp/\ncat /tmp/ | transfer";
return 1;