Skip to content

Instantly share code, notes, and snippets.

View laszlomiklosik's full-sized avatar

Laszlo Miklosik laszlomiklosik

View GitHub Profile
@laszlomiklosik
laszlomiklosik / curl send multi-line JSON payload example
Created July 24, 2019 08:28
curl request with inline multiline JSON payload
curl -X PATCH http://localhost:8080/Users/7234e4cd-eb7f-4a96-953e-3bd11439efcf -H 'Content-Type: application/json' -d @- <<BODY
{
"emails": [
"a@b.com",
"b@c.com"
]
}
BODY
@laszlomiklosik
laszlomiklosik / gist:2229643
Created March 28, 2012 19:18
Enable Windows style RDP server in Ubuntu
Why would you need this?
Because NxServer or VNC needs a special client installed in order to connect.
If your destination Ubuntu machine has multiple displays installed, you will eventually go crazy configuring it to be correctly seen from a Windows machine with a single display. It will show you 2 desktops on a single monitor...
Enabling Windows style RDP server in Ubuntu in easy.
Steps:
1. sudo apt-get install xrdp
2. cd ~
3. echo "gnome-session --session=gnome-classic" > .xsession
@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 / gist:9661756
Last active May 24, 2022 09:22
Allow remote access to postgres via username and password
1) in file /var/lib/pgsql/9.3/data/postgresql.conf change the default value 'localhost' to '*' (all) as shown
listen_addresses = '*'
2) in file /var/lib/pgsql/9.3/data/pg_hba.conf add line:
host all all all password
3) if it still does not work, you bet it's iptables fault. so either stop it temporarily to verify this or add an exception for port 5432
@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 / 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 / gist:2230082
Last active October 18, 2021 17:22
Sharing your Git repository using Git daemon
Sharing your Git repository using Git daemon (for pull & push)
1. In a git repository run the following command to share it in read-only mode (pull only):
git daemon --export-all --base-path=.
(from the folder with the project to be shared)
and then clone directly, like:
@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 / 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 / Capture packages with tcpdump or tcpflow
Last active May 29, 2019 10:36
Capture packages with tcpdump or tcpflow
# packages from localhost to localhost
sudo tcpdump -vvv -A -i lo port 8080
# packages from localhost to somewhere else
sudo tcpdump -vvv -A host 192.168.1.101
# packages coming and going on a specific port, specific interface
sudo tcpdump -vvv -A -i eth0 'port 8080'
# packages coming and going on a specific port, any interface