This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Sometimes you need to move your existing git repository | |
# to a new remote repository (/new remote origin). | |
# Here are a simple and quick steps that does exactly this. | |
# | |
# Let's assume we call "old repo" the repository you wish | |
# to move, and "new repo" the one you wish to move to. | |
# | |
### Step 1. Make sure you have a local copy of all "old repo" | |
### branches and tags. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# !/bin/bash | |
# ips: ip list file | |
# ./find_dead.sh > dead.log | |
# cat dead.log | grep -v ttl | awk '{ print $1 }' | |
IPS=`cat ips` | |
for i in $IPS; do | |
CODE=`ping -c 1 $i ` | |
echo $i $CODE | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// log4j configuration | |
log4j = { | |
appenders { | |
console name: 'stdout', encoder: pattern(conversionPattern: "%d{ISO8601} %p %c{2} %m%n") | |
appender new DailyRollingFileAppender( | |
name: 'rollingFileAppender', | |
file: "logs/cola.log", append: true, datePattern: "'.'yyMMdd", | |
layout: pattern(conversionPattern: "%d{ISO8601} %p %c{2} %m%n") | |
) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package util; | |
import org.apache.commons.io.IOUtils; | |
import org.apache.http.client.ResponseHandler; | |
import org.apache.http.client.config.CookieSpecs; | |
import org.apache.http.client.config.RequestConfig; | |
import org.apache.http.client.methods.HttpUriRequest; | |
import org.apache.http.impl.client.CloseableHttpClient; | |
import org.apache.http.impl.client.DefaultHttpRequestRetryHandler; | |
import org.apache.http.impl.client.HttpClients; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Grab(group='org.codehaus.groovy.modules.http-builder', module='http-builder', version='0.7.1') | |
import groovyx.net.http.AsyncHTTPBuilder | |
import groovyx.net.http.URIBuilder | |
import static groovyx.net.http.Method.POST | |
import static groovyx.net.http.ContentType.TEXT | |
import groovy.json.JsonSlurper | |
def http = new AsyncHTTPBuilder( poolSize:100 ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Order deny,allow | |
Deny from all | |
Allow from 10.1.0.0/8 | |
Allow from 172.16.0.0/12 | |
Allow from 192.168.0.0/16 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import groovy.json.JsonSlurper | |
new JsonSlurper() { | |
jsonSlurper -> new File('/Users/gregory/be.json').text.split('\n').collect { jsonSlurper.parseText(it).accountId }.unique().each { println it } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- SPLIT_STR MySQL Function | |
-- from http://blog.fedecarg.com/2009/02/22/mysql-split-string-function/ | |
CREATE FUNCTION SPLIT_STR( | |
x VARCHAR(255), | |
delim VARCHAR(12), | |
pos INT | |
) | |
RETURNS VARCHAR(255) | |
-- use CHAR_LENGTH instead of LENGTH to support utf8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.hibernate.proxy.HibernateProxy; | |
import org.hibernate.proxy.LazyInitializer; | |
import com.ngr.api.model.BaseModel; | |
/** | |
* | |
* public interface BaseModel<T> { | |
* public T getId(); | |
* } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>com.x</groupId> | |
<artifactId>y</artifactId> | |
<name>z</name> | |
<packaging>jar</packaging> | |
<version>1.0.0</version> | |
<properties> |