Skip to content

Instantly share code, notes, and snippets.

View laszlomiklosik's full-sized avatar

Laszlo Miklosik laszlomiklosik

View GitHub Profile
@laszlomiklosik
laszlomiklosik / How to avoid Git merge bubbles
Created October 15, 2012 20:51
How to avoid Git merge bubbles
# inspired by https://mriet.wordpress.com/2012/07/01/merge-bubbles-are-bad/
# and http://snipplr.com/view/26715/
# 1. first rebase all your local commits into one commit, e.g. for the last 3 commits into one you can use
git rebase -i HEAD~3
# and 'pick' the first, 'squash' the other commits
# 2. check the commit's sha id and save it somewhere
@laszlomiklosik
laszlomiklosik / Git settings
Created October 22, 2012 20:43
Git settings
git config --global user.name "John Doe"
git config --global user.email [email protected]
git config --global color.ui true
ssh-keygen -t rsa -C"[email protected]"
@laszlomiklosik
laszlomiklosik / Git utils
Last active October 11, 2015 23:08
Git utils
# select one of the 2 file versions during a merge
git checkout --ours index.html
git checkout --theirs _layouts/default.html
# see history in a nice tree form without gitk
git log --pretty=oneline --graph --decorate --all
# git add all including the renamed files without loosing history of the deleted file (as a rename implicitly looks like delete file and create new file)
git add . -A
@laszlomiklosik
laszlomiklosik / Launch linux terminal from Eclipse
Created October 24, 2012 05:54
Launch linux terminal from Eclipse
1. Select new launch configuration
2. use /usr/bin/nohup for location
3. leave the working directory empty
4. for argument enter:
gnome-terminal --working-directory=${resource_loc}
5. Save and then you are able to run it while having different locations selected in package explorer: this will open the terminal in the corresponding directories
@laszlomiklosik
laszlomiklosik / Linux which application-process uses a given port
Last active February 11, 2021 08:54
Linux which application-process uses a given port
# run:
sudo netstat -lpn |grep :8080
# this will output something like:
tcp6 0 0 :::8080
:::* LISTEN 6782/java
# interpretation:
@laszlomiklosik
laszlomiklosik / Enable remote profiling for Tomcat using VisualVM
Created December 6, 2012 13:07
Enable remote profiling for Tomcat using VisualVM
# just add the below to setenv.sh
CATALINA_OPTS="$CATALINA_OPTS -Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.port=9090 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Djava.rmi.server.hostname=172.17.12.99"
# inspired by http://blog.markshead.com/1129/connecting-visual-vm-to-tomcat-7/
@laszlomiklosik
laszlomiklosik / Linux see number of open files allowed per process (too many open files related)
Created December 7, 2012 16:18
Linux see number of open files allowed per process (too many open files related)
@laszlomiklosik
laszlomiklosik / Monitor open threads with refresh
Created December 13, 2012 14:49
Monitor open threads with refresh
while true ; do
date
echo "DB1 threads: `netstat -an |grep '68.20' |grep ESTABLISHED|wc -l`" ;
echo "DB2 threads: `netstat -an |grep '67.20' |grep ESTABLISHED|wc -l`" ;
echo "ajp threads: `netstat -an |grep 8009 |grep ESTABLISHED|wc -l`" ;
echo "HINT if you see errors check details with: tail -1000 /var/log/catalina.out |grep ERROR -A 50 -B 50"
tail -500 /var/log/catalina.out |grep ERROR|tail -n 20
sleep 5;
clear;
done
@laszlomiklosik
laszlomiklosik / Maven multi-module build options
Created January 28, 2013 07:29
Maven multi-module build options
# Inspired from http://blog.akquinet.de/2010/05/26/mastering-the-maven-command-line-%E2%80%93-reactor-options/
# Build only specific modules:
mvn clean install -pl sub-module-name2
mvn clean install -pl sub-module-name2,sub-module-name3
# Build only starting from specific sub-module (resume from)
mvn clean install -rf sub-module-name2
# Build dependencies (also make)
@laszlomiklosik
laszlomiklosik / mysql: connect, create user and database
Last active December 12, 2015 09:39
mysql: connect, create user and database
sudo mysql --user=root mysql --password
CREATE DATABASE your_db DEFAULT CHARACTER SET utf8;
CREATE USER 'your_user'@'%' IDENTIFIED BY 'your_pass';
GRANT ALL PRIVILEGES ON your_db.* TO 'your_user'@'%';