Skip to content

Instantly share code, notes, and snippets.

//EXAMPLE evolution.scala
import java.io.{File, FilenameFilter}
import com.datastax.driver.core.Session
import org.apache.commons.io.filefilter.SuffixFileFilter
import org.joda.time.{DateTime, DateTimeZone}
import play.api.Play.current
import play.api.{Logger, Play}
@sunnyone
sunnyone / gist:878fb959925ba0fbd1aa
Created April 13, 2015 02:30
Terraform heroku example
provider "heroku" {
email = "test@example.com"
api_key = "call heroku auth:token"
}
resource "heroku_app" "default" {
name = "herokutest"
region = "us"
config_vars {
@aanari
aanari / batch_at_will_commander.sql
Last active August 8, 2020 15:31
7 PostgreSQL data migration hacks you should be using (but aren't)
CREATE FUNCTION batch_at_will() RETURNS INTEGER LANGUAGE plpgsql AS $$
DECLARE batched_count INTEGER = 1;
BEGIN
WITH selected_users AS (
SELECT id
FROM users
WHERE role = 'moderator'
AND registration_date < CURRENT_DATE - INTERVAL '4' YEAR
LIMIT 1000
FOR UPDATE NOWAIT
@sirkkalap
sirkkalap / Install-Docker-on-Linux-Mint.sh
Last active December 8, 2022 18:38
Install Docker on Linux Mint
##########################################
# To run:
# curl -sSL https://gist.githubusercontent.com/sirkkalap/e87cd580a47b180a7d32/raw/d9c9ebae4f5cf64eed4676e8aedac265b5a51bfa/Install-Docker-on-Linux-Mint.sh | bash -x
##########################################
# Check that HTTPS transport is available to APT
if [ ! -e /usr/lib/apt/methods/https ]; then
sudo apt-get update
sudo apt-get install -y apt-transport-https
fi
anonymous
anonymous / gist:e028eacd8ce1dd8c21bd
Created January 17, 2015 00:39
Instruction Manual for the Executioner
# Instruction Manual for the Executioner
You knew that you would be the one to do this dirty
task.
You knew from the moment you saw the first warning
signs: the servers capable of handling thousands of
requests per second, but barely being utilized.
You knew from the moment the CEO called that morning
@dpryden
dpryden / ClassLoaderLeakExample.java
Created October 20, 2014 00:01
Example of a ClassLoader leak in Java
import java.io.IOException;
import java.net.URLClassLoader;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.Path;
/**
* Example demonstrating a ClassLoader leak.
*
* <p>To see it in action, copy this file to a temp directory somewhere,
@sebsto
sebsto / gist:19b99f1fa1f32cae5d00
Created August 8, 2014 15:53
Install Maven with Yum on Amazon Linux
sudo wget http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -O /etc/yum.repos.d/epel-apache-maven.repo
sudo sed -i s/\$releasever/6/g /etc/yum.repos.d/epel-apache-maven.repo
sudo yum install -y apache-maven
mvn --version
@schoenobates
schoenobates / jooq.gradle
Created June 19, 2014 10:32
JOOQ Generator Gradle
import org.jooq.util.jaxb.*
import org.jooq.util.*
ext.db = [
url: 'jdbc:postgresql://host/db',
user: 'user',
password: 'user',
schema: 'schema'
]
@booherbg
booherbg / gist:f812c9145d157d8945b2
Last active February 25, 2022 23:44
Cross compiling a simple go server for windows

How to build Golang windows/arm static binaries from linux

Alternate title: Cross compiling Windows/Darwin/Linux amd64/386/arm all from linux

After fumbling around trying to figure out the go toolchain and cross compilation configuration, I ran across the wiki page on Go's homepage. It's super helpful, and worked out of the box. I'm including the necessary scripts here in case they get changed or lost, and we can help Google find it (since it's the first real source I've found that "Just Worked"). http://code.google.com/p/go-wiki/wiki/WindowsCrossCompiling

@stevehanson
stevehanson / Email.java
Created May 8, 2014 14:37
Mailgun Example - Java
package com.abc.model;
import java.util.List;
public class Email {
private String from;
private List<String> to;
private List<String> cc;
private List<String> bcc;