Skip to content

Instantly share code, notes, and snippets.

View Raffo's full-sized avatar
:fishsticks:
Busy with my family, stepped away from opensource duties for a while.

Raffaele Di Fazio Raffo

:fishsticks:
Busy with my family, stepped away from opensource duties for a while.
View GitHub Profile
@Raffo
Raffo / ssh-scp.md
Last active October 14, 2015 16:17
Fun with ssh and scp

Fun with ssh and scp

Estabilish a shh tunnel

ssh -i private_key user@remote_host -L local_port:remote_host:remote_port -f -N

scp to remote host

scp file user@IP:/dir/to/write/to

SOCKS5 dirty trick

ssh -D127.0.0.1:1080 vagrant@localhost -p 2222

@Raffo
Raffo / git.md
Last active April 29, 2019 08:14
Saving some common GIT patterns

Keep a branch in sync with master

git checkout master
git pull
git checkout branchname
git merge master

I made some changes on the master but I want to bring (and commit) them to a different (NEW) branch.

@Raffo
Raffo / Docker.md
Last active December 21, 2017 09:40

ssh into a running docker container

sudo docker exec -i -t 665b4a1e17b6 bash #by ID

Removes all the exited containers.

docker rm $(docker ps -q -f status=exited)

Get logfile for a container:

@Raffo
Raffo / Java.md
Last active August 29, 2015 14:19
Java

Java Print Method name //This is really dirty, but works, do not use this for production code, just for testing purposes.

public String getCurrentMethodName() {
	StackTraceElement stackTraceElements[] = (new Throwable()).getStackTrace();
	return stackTraceElements[1].toString();
}
@Raffo
Raffo / Oracle.md
Last active May 11, 2018 19:44
Oracle

Oracle SQL distinct on single column

 select * 
 from TABLE_NAME 
 where rowid in 
  (
    select max(ROWID) 
    from TABLE_NAME 
    GROUP BY COLUMN_NAME
@Raffo
Raffo / Android.md
Last active December 4, 2017 03:58
Android