Skip to content

Instantly share code, notes, and snippets.

View laszlomiklosik's full-sized avatar

Laszlo Miklosik laszlomiklosik

View GitHub Profile
@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 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 / 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 / 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 / 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 / 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 / Configure meld as git diff and merge tool
Created October 11, 2012 19:27
Configure meld as git diff and merge tool
# inspired from http://nathanhoad.net/how-to-meld-for-git-diffs-in-ubuntu-hardy
# and http://gitguru.com/2009/02/22/integrating-git-with-a-visual-merge-tool/
sudo apt-get install meld
# create a python script with the below content and name it diff.py
#!/usr/bin/python
@laszlomiklosik
laszlomiklosik / Git view change between commits per file
Created October 4, 2012 14:44
Git: view change between commits per file
git diff commit_id1..commit_id2 -- path/to/file
@laszlomiklosik
laszlomiklosik / Git: undo git rm for a single file
Created October 4, 2012 14:43
Git: undo git rm for a single file
git checkout HEAD path/to/file
# Without HEAD it's not working because the file is not there anymore
@laszlomiklosik
laszlomiklosik / Setting up vsftpd access in ubuntu
Created August 16, 2012 06:45
Setting up vsftpd access in ubuntu
1. sudo apt-get install vsftpd
2. nano /etc/vsftpd.conf
uncomment:
local_enable=YES
write_enable=YES
comment:
#anonymous_enable=YES