Skip to content

Instantly share code, notes, and snippets.

@asiletto
asiletto / install.sh
Last active August 29, 2015 14:18
install & configure mongodb on virtualbox
# install a plain ubuntu with openssh server with 50Gb dynamic drive
#
apt-get update
apt-get dist-upgrade
#
# clone the image
#
# install mongodb on cloned image
apt-get install -y mongodb
#
@asiletto
asiletto / docker-virtualbox-test.sh
Last active August 29, 2015 14:16
docker hello world - install and run an apache2
root@ubuntu:~# docker run -t -i ubuntu /bin/bash
root@e7ec762cee11:/# apt-get update && apt-get install apache2
root@e7ec762cee11:/# exit
root@ubuntu:~# docker commit e7ec762cee11 asiletto/test
root@ubuntu:~# docker run --name ap1 -d -p 80:80 asiletto/test /usr/sbin/apache2ctl -D FOREGROUND
root@ubuntu:~# links http://localhost/
@asiletto
asiletto / netmask.txt
Created February 28, 2015 14:02
netmasks
Netmask Netmask (binary) CIDR Notes
_____________________________________________________________________________
255.255.255.255 11111111.11111111.11111111.11111111 /32 Host (single addr)
255.255.255.254 11111111.11111111.11111111.11111110 /31 Unuseable
255.255.255.252 11111111.11111111.11111111.11111100 /30 2 useable
255.255.255.248 11111111.11111111.11111111.11111000 /29 6 useable
255.255.255.240 11111111.11111111.11111111.11110000 /28 14 useable
255.255.255.224 11111111.11111111.11111111.11100000 /27 30 useable
255.255.255.192 11111111.11111111.11111111.11000000 /26 62 useable
255.255.255.128 11111111.11111111.11111111.10000000 /25 126 useable
apt-get install virtualbox-guest-dkms
reboot
adduser root vboxsf
adduser asiletto vboxsf
#install & minimal mysql config (starting point for a docker container)
apt-get update
#apt-get update && apt-get upgrade -y
echo "mysql-server-5.6 mysql-server/root_password password root" | sudo debconf-set-selections
echo "mysql-server-5.6 mysql-server/root_password_again password root" | sudo debconf-set-selections
apt-get -y install mysql-server-5.6
sed -i 's/127\.0\.0\.1/0\.0\.0\.0/g' /etc/mysql/my.cnf
mysql -uroot -proot -e 'USE mysql; UPDATE `user` SET `Host`="%" WHERE `User`="root" AND `Host`="localhost"; DELETE FROM `user` WHERE `Host` != "%" AND `User`="root"; FLUSH PRIVILEGES;'
service mysql restart
@asiletto
asiletto / deploy-jar-to-aws-with-maven.sh
Last active August 29, 2015 14:14
setup a maven jar project and build to aws repository
#generate maven from archetype
mvn archetype:generate \
-DgroupId=it.siletto \
-DartifactId=simpleProject \
-DarchetypeArtifactId=maven-archetype-quickstart \
-DinteractiveMode=false
#generate eclipse metadata
mvn eclipse:eclipse -DdownloadSources=true
@asiletto
asiletto / info.txt
Created January 12, 2015 16:37
trasferimento file da z/OS a windows
aggiungere sul client ftp il comando
SITE SBD=(IBM-1047,ISO8859-1)
subito dopo la connessione.
si puo' fare con WinSCP
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Test dojo singleton</title>
</head>
<body>
<!-- load Dojo -->
<script src="dojo.js"
data-dojo-config="async: true"></script>
define(["dojo/_base/declare"], function(declare){
var TestApp = declare(null, {
constructor: function(){
console.log("constructor is called only once");
this.key = Math.random();
},
sayHello : function(){
alert("hello: "+this.key);
}
});
@asiletto
asiletto / android dp.java
Created July 23, 2014 15:57
Get width height and orientation in android
Display display = getWindowManager().getDefaultDisplay();
DisplayMetrics outMetrics = new DisplayMetrics();
display.getMetrics(outMetrics);
float density = getResources().getDisplayMetrics().density;
float dpHeight = outMetrics.heightPixels / density;
float dpWidth = outMetrics.widthPixels / density;
Log.d("SIZE","height: "+dpHeight+"dp, width:"+dpWidth+"dp, orientation:"+display.getRotation());