Skip to content

Instantly share code, notes, and snippets.

Java profiling

async-profiler

Low overhead sampling profiler for Java that does not suffer from Safepoint bias problem.

./profiler.sh -e wall -t -i 5ms -f result.svg 8983
@ssledz
ssledz / maven-archetype.list
Created January 26, 2017 14:47 — forked from zbigniewTomczak/maven-archetype.list
Maven archetypes list (mvn archetype:generate)
Choose archetype:
1: remote -> br.gov.frameworkdemoiselle.archetypes:demoiselle-jsf-jpa (Archetype for web applications (JSF + JPA) using Demoiselle Framework)
2: remote -> br.gov.frameworkdemoiselle.archetypes:demoiselle-minimal (Basic archetype for generic applications using Demoiselle Framework)
3: remote -> co.ntier:spring-mvc-archetype (An extremely simple Spring MVC archetype, configured with NO XML.)
4: remote -> com.agilejava.docbkx:docbkx-quickstart-archetype (-)
5: remote -> com.alibaba.citrus.sample:archetype-webx-quickstart (-)
6: remote -> com.bsb.common.vaadin:com.bsb.common.vaadin.embed-simple-archetype (-)
7: remote -> com.bsb.common.vaadin:com.bsb.common.vaadin7.embed-simple-archetype (-)
8: remote -> com.cedarsoft.open.archetype:multi (-)
9: remote -> com.cedarsoft.open.archetype:simple (-)
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd">
<profiles>
<profile>
<id>local</id>
<properties>
<internal.repo.path>file://${user.home}/mvn-repo/releases</internal.repo.path>
<internal.snapshots-repo.path>file://${user.home}/mvn-repo/snapshots</internal.snapshots-repo.path>
</properties>
</profile>
@ssledz
ssledz / pom.xml
Created January 29, 2017 02:19 — forked from nwinkler/pom.xml
Combining the git-flow branching model and the Maven Release Plugin to play nice. Based on info found here: http://vincent.demeester.fr/2012/07/maven-release-gitflow/
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>group</groupId>
<artifactId>dummy</artifactId>
<name>Dummy Project</name>
<version>1.0.12</version>
<packaging>pom</packaging>
<scm>
<connection>scm:git:https://......</connection>
<tag>HEAD</tag>

installation

sudo add-apt-repository ppa:octave/stable
sudo apt-get update
sudo apt-get install octave

resources

Outputting floor numbers with two decimal digits with dot as a decimal separator

DecimalFormatSymbols symbols = DecimalFormatSymbols.getInstance();
symbols.setDecimalSeparator('.');
DecimalFormat df = new DecimalFormat("#.##", symbols);
df.setRoundingMode(RoundingMode.FLOOR);
df.setGroupingUsed(false);
df.format(1.2345); // 1.23
@ssledz
ssledz / getopts-template.sh
Last active February 9, 2017 09:07
Parsing command line arguments using getopts in bash
#!/bin/bash
DBG=0
dbg() {
[[ $DBG == 1 ]] && (1>&2 echo "[DEBUG] : "$1)
}
info() {
echo "[INFO] : $1"
@ssledz
ssledz / aw-alert.sh
Last active February 9, 2017 09:07
mcabber eventcmd for awesome wm
#!/bin/bash
DBG=0
dbg() {
[[ $DBG == 1 ]] && (1>&2 echo "[DEBUG] : "$1)
}
info() {
echo "[INFO] : $1"
# legend
^ means ctrl
# ctags
:!ctags *.m
:ta[g][!] tagstring # edit the file containing tagstring
:po[p][!] # pop the tagstack by one element
:tags

check what listening on port 80

sudo ss -nltp | grep 80

encrypting compressed folder

tar cz my_folder/ | openssl enc -aes-256-cbc -e > encrypted.tar.gz.enc