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
# prereqs | |
sudo apt-get update | |
sudo /usr/bin/apt-get install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion pkg-config | |
# multiuser rvm | |
$ \curl -L https://get.rvm.io | sudo bash -s stable --ruby=ruby-1.9.3-p362 | |
# add user to rvm group | |
sudo usermod -a -G rvm ubuntu | |
$ logout and log back in |
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
-- Check the total size of each database | |
SELECT | |
tables.TABLE_SCHEMA AS database_name, | |
ROUND(SUM(tables.DATA_LENGTH + tables.INDEX_LENGTH) / POWER(2, 30), 3) AS database_size_in_gb | |
FROM information_schema.TABLES AS tables | |
GROUP BY tables.TABLE_SCHEMA | |
ORDER BY database_size_in_gb DESC; | |
-- List all tables larger than 1 GB | |
SELECT |
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
// HTTP client for testing high connection concurrency | |
// Authors: Richard Jones and Rasmus Andersson | |
// Released in the public domain. No restrictions, no support. | |
// SEE: | |
// http://rsms.me/2009/10/05/10k-comet-connections.html | |
#include <sys/types.h> | |
#include <sys/time.h> | |
#include <sys/queue.h> |
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
require 'handsoap' | |
require 'openssl' | |
class AddressValidator < Handsoap::Service | |
self.logger=$stdout | |
# https://fastaddress-beta.peachtreedata.com/rtac/?wsdl | |
ENDPOINT = {:uri => 'https://fastaddress-beta.peachtreedata.com/rtac/', :version => 1} | |
endpoint ENDPOINT |
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
require 'rubygems' | |
require 'find' | |
require 'pp' | |
class UnusedImagesFinder | |
def find_unused_assets | |
puts "Lists unused files based upon explicit programatic checks. Requires manual confirmation before deletion." | |
puts "------------------ Building css from sass ------------------" | |
system 'rake build_static:stylesheets' |
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 com.example.utility; | |
import com.google.common.base.Predicate; | |
import com.google.common.collect.ImmutableList; | |
import static com.google.common.collect.Iterables.*; | |
import org.joda.time.LocalDate; | |
import org.joda.time.LocalDateTime; | |
import org.joda.time.LocalTime; | |
import java.beans.BeanInfo; |
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 com.example.spring; | |
import org.springframework.beans.factory.FactoryBean; | |
import org.springframework.beans.factory.ObjectFactory; | |
import org.springframework.web.context.request.AbstractRequestAttributesScope; | |
import org.springframework.web.context.request.RequestAttributes; | |
import org.springframework.web.context.request.RequestContextHolder; | |
public class FactoryRequestScope extends AbstractRequestAttributesScope{ |
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
// Use functional programming idioms that google collections (now called google guava) give you. | |
// Given: | |
private static final Set<String> CLEARABLE_PATHS = Sets.newHashSet("/app/search", "/app/logout"); | |
// Don't be iterative: | |
// BAD | |
private boolean shouldClearCookie() { | |
for (Iterator<String> stringIterator = CLEARABLE_PATHS.iterator(); stringIterator.hasNext();) { | |
String clearablePath = stringIterator.next(); |
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 com.example.spring; | |
import org.apache.log4j.Logger; | |
import org.springframework.beans.BeansException; | |
import org.springframework.beans.factory.support.DefaultListableBeanFactory; | |
import java.util.Arrays; | |
import java.util.Map; | |
import java.util.concurrent.ConcurrentHashMap; |
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
#!/usr/bin/env bash | |
# make.sh script to build maven | |
path=$(cd ${0%/*} && pwd -P) | |
. $path/mvnopts | |
# contents of mvnopts: | |
# export MAVEN_OPTS="-Xmx1024m -XX:MaxPermSize=512m" | |
usage() | |
{ |
NewerOlder