Skip to content

Instantly share code, notes, and snippets.

View jthmiranda's full-sized avatar
🎯
Focusing

Jonathan Miranda jthmiranda

🎯
Focusing
View GitHub Profile
@jthmiranda
jthmiranda / docker_mv_dir.sh
Created August 10, 2015 22:02
change docker directory to another partition
turns out you don't need the bind mount. This works with current docker by just modifying the -g option in /etc/docker/defaults DOCKER_OPTS. I had previously tried this and maybe like you failed to get it to work, and looked to linking and bind mounting.
Tried on AWS EC2 VM on a Ubuntu 14.04 server, with a second block storage volume.
First prepare your new block storage, this will house the moved docker folder
First format and mount the new block storage device
mkfs.ext4 /dev/sdx
Mount it
create a mount point
mkdir /mnt/diskX
@jthmiranda
jthmiranda / newdate.java
Last active August 29, 2015 14:27
new data jasperreport
// para insertar fecha en campo textfield
new java.text.SimpleDateFormat("dd-MMM-yyyy HH:mm:ss z", java.util.Locale.US).format(new java.util.Date())
// para mostrar fecha en español
new Locale("ES")
// usando groovy
new groovy.lang.GroovyShell().evaluate("Calendar cal = Calendar.getInstance(); cal.set(2009, 8, 8); return cal.getTime(); ")
![alt text](http://i.stack.imgur.com/O56lf.jpg "ejemplo de fecha")
@jthmiranda
jthmiranda / nginx.conf
Last active September 1, 2015 18:00
algunas configuraciones de reverse proxy, algunas faltan afinar
server {
listen 80;
server_name app.bolpros.com 10.11.25.2:8000;
# Strict Transport Security
add_header Strict-Transport-Security max-age=2592000;
rewrite ^/mobile.*$ https://10.0.2.15/web_mobile/static/src/web_mobile.html permanent;
rewrite ^/webdav(.*)$ https://10.0.2.15/webdav/$1 permanent;
@jthmiranda
jthmiranda / mesos-dns-setupd.md
Created September 1, 2015 22:40
detalle para configurar mesos-dns con docker

Mesos-DNS

Scripts for setting up

sudo mkdir /etc/mesos-dns
sudo vi /etc/mesos-dns/config.json

config.json

@jthmiranda
jthmiranda / ejemploo_llaves
Created September 10, 2015 17:57
{,} en los comandos de Linux y Unix?
Por lo general utilizo esto {,} cuando necesito crear archivos numerados: archivo1, archivo2, archivo”n”:
> [ rafael ] ~ $ touch archivo{1..3}.log
> [ rafael ] ~ $ ls -lt
total 0
-rw-r--r-- 1 rafael 0xl337 0B Nov 4 00:52 archivo1.log
-rw-r--r-- 1 rafael 0xl337 0B Nov 4 00:52 archivo2.log
-rw-r--r-- 1 rafael 0xl337 0B Nov 4 00:52 archivo3.log
> [ rafael ] ~ $
@jthmiranda
jthmiranda / unmaskdocker.sh
Created September 29, 2015 19:15
to enable again when docker daemon is masked... yet don't know why happen
# when you try to start docker
# sudo systemctl start docker
# and the output is: Failed to start docker.service: Unit docker.service is masked.
#
#
# ls -la /etc/systemd/system | grep docker
# see for /dev/null if there is
systemctl unmask docker.service
systemctl unmask docker.socket
systemctl start docker.service
#!/bin/bash
IMAGE_IDS=$(docker images -q --filter="dangling=true")
if [ -n "$IMAGE_IDS" ]; then
docker rmi $IMAGE_IDS > /dev/null 2>&1
fi
@jthmiranda
jthmiranda / docker.service
Created October 19, 2015 14:02
workaround for -> WARNING: Module br_netfilter not found | go to /usr/lib/systemd/system/docker.service
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network.target docker.socket
Requires=docker.socket
[Service]
Type=notify
ExecStart=/usr/bin/docker daemon -g /home/oracle/docker/docker/ -H fd://
MountFlags=slave
@jthmiranda
jthmiranda / add-apt-repository
Created October 21, 2015 13:42
kali linux 2 code replacement for add-apt-repository /usr/bin/add-apt-repository
#!/bin/bash
if [ $# -eq 1 ]
NM=`uname -a && date`
NAME=`echo $NM | md5sum | cut -f1 -d" "`
then
ppa_name=`echo "$1" | cut -d":" -f2 -s`
if [ -z "$ppa_name" ]
then
echo "PPA name not found"
echo "Utility to add PPA repositories in your debian machine"
@jthmiranda
jthmiranda / owncloud.conf
Created October 21, 2015 14:22
Install ownCloud in a subdirectory using nginx
upstream php-handler {
server 127.0.0.1:9000;
#server unix:/var/run/php5-fpm.sock;
}
server {
listen 80;
server_name example.com;
return 301 https://$server_name$request_uri;
}