Skip to content

Instantly share code, notes, and snippets.

View vicendominguez's full-sized avatar

Vicen Domínguez vicendominguez

View GitHub Profile
@vicendominguez
vicendominguez / gist:8973950
Created February 13, 2014 12:06
Convert chroma (00ff00) background color to black to make mask images (jpg)
for a in *.jpg; do convert $a -fuzz 50% -fill black -opaque "#00ff00" -type Grayscale ../MASKS/$a;done
@vicendominguez
vicendominguez / gist:8978478
Last active August 29, 2015 13:56
Firewall rules to redirect Glassfish 4.0 ports (80,443,8080 and 8181 will be open to internet)
iptables -A INPUT -p tcp --dport 8080 -j ACCEPT
iptables -A INPUT -p tcp --dport 8181 -j ACCEPT
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 8080
iptables -A INPUT -p tcp --dport 443 -j ACCEPT
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 443 -j REDIRECT --to-ports 8181
@vicendominguez
vicendominguez / gist:9056884
Last active August 29, 2015 13:56
Full site in SSL with exception of knowledged path in lighttpd
# When http then https but no redirect for "knowledgebase" path
$HTTP["scheme"] == "http" {
$HTTP["host"] =~ "secure.site.com" {
url.redirect = ( "^/(?!(knowledgebase).*)" => "https://secure.site.com/$1" )
server.document-root = "/site/secure"
}
}
#behavior for SSL
$HTTP["scheme"] == "https" {
$HTTP["host"] =~ "^secure\.site\.com" {
@vicendominguez
vicendominguez / glassfish
Created February 19, 2014 10:50
Glassfish init for CentOS (using non-root user)
#!/bin/bash
# description: Glassfish Start Stop Restart
# processname: glassfish
# chkconfig: 234 20 80
JAVA_HOME=/usr/java/default
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
export PATH
GLASSFISH_HOME=/usr/local/glassfish4/glassfish
GLASSFISH_USER=glassfish
@vicendominguez
vicendominguez / Makefile
Created May 13, 2014 09:30
One makefile to rule them all
all:
$(MAKE) -C directory1
$(MAKE) -C directory2
$(MAKE) -C directory3
clean:
$(MAKE) -C directory1 clean
$(MAKE) -C directory2 clean
$(MAKE) -C directory3 clean
@vicendominguez
vicendominguez / playbook.yaml
Created May 19, 2014 14:59
Ansible:plauing with pub keys
#this is a part of the original playbook:
- name: Creating pub SSH keys
command: ssh-keygen -N '' -f /root/.ssh/id_rsa
- name: Downloading pub key
fetch: src=/root/.ssh/id_rsa.pub dest=/tmp/id_rsa.tmp flat=yes
- name: Coping local key to other.server.net
local_action: shell cat /tmp/id_rsa.tmp | ssh -p 2244 [email protected] "cat >> /root/.ssh/authorized_keys"
@vicendominguez
vicendominguez / iperfd
Created August 5, 2014 10:51
iperf server as a daemon for bandwidth checking in RHEL6
#! /bin/bash
#
# iperf advanced bandwidth test tool
#
# chkconfig: - 90 60
# description: iperf is an advanced bandwidth test tool
# processname: iperf
# pidfile: /var/run/iperf.pid
# Source function library.
. /etc/init.d/functions
@vicendominguez
vicendominguez / stats.conf
Created September 4, 2014 14:34
Minimal collectd-web configure
# Configuration for collectd-web
ScriptAlias /stats/cgi-bin/ /var/www/collectd-web-master/cgi-bin/
Alias /stats/ /var/www/collectd-web-master/
DirectoryIndex index.html
<Directory "/var/www/collectd-web-master/">
AllowOverride All
AuthType Basic
AuthName "Restringido"
@vicendominguez
vicendominguez / OldLinksysMustDie.py
Created September 6, 2014 06:41
For WAG200* and WAG54* old firmware - My Old Linksys DOS PoC
#!/usr/bin/python
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@vicendominguez
vicendominguez / process_mon.py
Created September 24, 2014 12:00
Fast process monitor daemon in python with logger and email notifier
#!/usr/bin/env python
import os, smtplib
from sys import exit