Skip to content

Instantly share code, notes, and snippets.

View eresende's full-sized avatar

Eusebio Resende eresende

  • NuoDB/3DS
  • Dublin, Ireland
View GitHub Profile
def busyExecutors = Jenkins.instance.computers
.collect {
c -> c.executors.findAll { it.isBusy() }
}
.flatten()
busyExecutors.each { e ->
if (e.getCurrentExecutable().getParent().getOwnerTask().getName() == "JobName") {
e.doStop()
@eresende
eresende / vardefs.php
Created November 28, 2016 17:29
SuiteCRM and SecurityGroups - Custom Modules
$dictionary["custom_module_securitygroups"] = array(
'true_relationship_type' => 'many-to-many',
'relationships' =>
array(
'custom_module_securitygroups' =>
array(
'lhs_module' => 'SecurityGroups',
'lhs_table' => 'securitygroups',
'lhs_key' => 'id',
'rhs_module' => 'custom_Module',
@eresende
eresende / docker-reverse-proxy.conf
Created October 17, 2016 14:15
Nginx reverse proxy for docker containers
upstream demo1.localhost {
server 172.17.0.4:5000;
server 172.17.0.3:5000;
}
server {
#ssl_certificate /etc/nginx/certs/demo.pem;
#ssl_certificate_key /etc/nginx/certs/demo.key;
gzip_types text/plain text/css application/json application/x-javascript
@eresende
eresende / copy_files.sh
Created December 11, 2015 10:42
Copy files by extension and maintain structure
find . -name '*.csv' -exec cp --parents \{} /target \;
@eresende
eresende / CreateNewObject.js
Created November 9, 2015 21:31
How to create a new javascript object to deal with forms.
var Forms = (function(Forms) {
Forms.requestDemo = {
init: function(){
var self = Forms.requestDemo;
console.log('initalize stuff');
self._initFormFields();
@eresende
eresende / generate-ssl.sh
Created October 22, 2015 09:13
Generate a wildcard SSL certificate
#!/usr/bin/env bash
# Specify where we will install
# the xip.io certificate
SSL_DIR="/etc/ssl/xip.io"
# Set the wildcarded domain
# we want to use
DOMAIN="*.xip.io"
@eresende
eresende / mysql_forward.sh
Created October 21, 2015 08:42
Forward MySQL port to another IP with IPTABLES
iptables -t nat -A PREROUTING -p tcp --dport 3306 -j DNAT --to 10.0.4.172:3306
iptables -A FORWARD -p tcp -d 10.0.4.172 --dport 3306 -j ACCEPT
iptables -t nat -A POSTROUTING -j MASQUERADE
@eresende
eresende / storage.sh
Created March 26, 2015 10:07
List disk storage consumption by folder
du -d 1 ~ | sort -n -r
@eresende
eresende / nif-pt.js
Last active April 11, 2024 15:49
Validação de NIF Portugal com Javascript
/*
Source: http://www.portugal-a-programar.pt/topic/58852-algoritmo-de-validacao-de-nif-pt/
*/
function validaContribuinte(contribuinte){
// algoritmo de validação do NIF de acordo com
// http://pt.wikipedia.org/wiki/N%C3%BAmero_de_identifica%C3%A7%C3%A3o_fiscal
var temErro=0;
@eresende
eresende / import_gzip_database.sh
Created February 10, 2015 16:36
Import gziped mysql dump file
gunzip < DUMP_FILE.sql.gz | mysql --user=DB_USER --password DB_NAME