Skip to content

Instantly share code, notes, and snippets.

Avatar

Maurizio Pillitu maoo

View GitHub Profile
View OutputStream to byte Array
ByteArrayOutputStream baos = new ByteArrayOutputStream();
int red = 0;
boolean finished = false;
byte[] tempdata = new byte[1024];
while (!finished) {
red = instr.read(tempdata);
if (red > 0) {
baos.write(tempdata, 0, red);
} else {
finished = true;
View Find and exec grep
find . -type f -exec grep -l 'what to search' \{} \;
View SSH Tunnel
ssh -L 8888:host-source:8888 user@host-dest -g cat -
View ifconfig set static IP
ifconfig eth0 192.10.200.111 netmask 255.255.255.0 up
View svn server add user
htpasswd2 /var/svn/conf/svnusers simone
View mysql adduser
## First * : privileges
## Second * : DB name
## Third * : Table name
grant * on *.* to 'username'@'localhost' identified by 'password';
flush privileges;
View Kill with Grep
ps -edaf | grep something_to_grep | awk '{print $2}' | xargs kill -s 9
View Java Remote Debug
JAVA_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n"