Skip to content

Instantly share code, notes, and snippets.

View paganotoni's full-sized avatar
💭
⚡️⚡️

Antonio Pagano paganotoni

💭
⚡️⚡️
View GitHub Profile
@paganotoni
paganotoni / DJ_by_handler.rb
Created June 19, 2012 21:33
Deleting delayed Jobs by handler.
Delayed::Job.where("handler LIKE '%shift_sms% #{id}%'").each{|job| job.destroy }
@paganotoni
paganotoni / hack.sh
Created June 20, 2012 13:34 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@paganotoni
paganotoni / grails-has-many-deletion.groovy
Created July 4, 2012 18:08
Grails has Many deletion
Child child = Child.get( childId )
Parent parent = child.parent
parent.children.remove( child )
child.delete()
@paganotoni
paganotoni / valid-email-address.java
Created July 6, 2012 05:20
Java Valid Email Address
Pattern pattern = Pattern.compile("[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}");
@paganotoni
paganotoni / EBSDeploy.groovy
Created October 13, 2012 14:57
Grails Amazon EBS deploy Script
includeTargets << grailsScript("_GrailsInit")
import com.amazonaws.auth.*
import com.amazonaws.services.s3.*
import com.amazonaws.services.elasticbeanstalk.*
import com.amazonaws.services.elasticbeanstalk.model.*
def projectWarFilename
def optionMap = [scripts: []]
@paganotoni
paganotoni / ssh-known-hosts-mgmt.sh
Created October 25, 2012 04:07 — forked from bradland/ssh-known-hosts-mgmt.sh
SSH known_hosts tools
# This is a short collection of tools that are useful for managing your
# known_hosts file. In this case, I'm using the '-f' flag to specify the
# global known_hosts file because I'll be adding many deploy users on this
# system. Simply omit the -f flag to operate on ~/.ssh/known_hosts
# Add entry for host
ssh-keyscan -H github.com > /etc/ssh/ssh_known_hosts
# Scan known hosts
ssh-keygen -f /etc/ssh/ssh_known_hosts -H -F github.com
@paganotoni
paganotoni / primesScript.groovy
Created November 3, 2012 20:02
Simple Prime Numbers Groovy Script
#!/usr/bin/env groovy
public class PrimeNumberEvaluator {
// Evaluates a number looking if its prime or not
static boolean isPrime( def number ){
def divisors = []
for( def possibleDivisor in (1..number) ){
if( (number % possibleDivisor) == 0 ){ divisors << possibleDivisor }
if( divisors.size() > 2 ){ break }
@paganotoni
paganotoni / portInUse.groovy
Created December 2, 2012 16:09
Checking port in use
boolean portTaken = false;
ServerSocket socket = null;
try {
socket = new ServerSocket(portNumber);
} catch (IOException e) {
portTaken = true;
} finally {
// Clean up
if (socket != null) socket.close();
}
@paganotoni
paganotoni / tomcat.sh
Created December 3, 2012 18:13 — forked from valotas/tomcat.sh
Tomcat init.d script
#!/bin/bash
#
# tomcat7 This shell script takes care of starting and stopping Tomcat
#
# chkconfig: - 80 20
#
### BEGIN INIT INFO
# Provides: tomcat7
# Required-Start: $network $syslog
# Required-Stop: $network $syslog
@paganotoni
paganotoni / ngnix_reverse
Created December 7, 2012 04:25
ngnix reverse proxy
upstream app_server {
server 127.0.0.1:8080 fail_timeout=0;
}
server {
listen 80;
listen [::]:80 default ipv6only=on;
server_name ci.yourcompany.com;
location / {