Skip to content

Instantly share code, notes, and snippets.

View chuwy's full-sized avatar

Anton Parkhomenko chuwy

View GitHub Profile
import java.io.{File, PrintWriter}
import org.json4s.jackson.JsonMethods._
def printToFile(f: File)(op: PrintWriter => Unit) {
val p = new java.io.PrintWriter(f)
try { op(p) } finally { p.close() }
}
object jsonGen extends JsonGen
@chuwy
chuwy / Dockerfile
Last active August 29, 2015 14:24
Beanstalk
# Dockerfile
FROM java:7
MAINTAINER Snowplow Analytics, support@snowplowanalytics.com
WORKDIR /
USER daemon
EXPOSE 8000
ADD start.sh /tmp/
CMD ./tmp/start.sh
package com.snowplowanalytics.schemaguru.utils;
import java.io.*;
import com.fasterxml.jackson.core.*;
import com.fasterxml.jackson.core.util.DefaultPrettyPrinter;
public class SuperPrinter extends DefaultPrettyPrinter
{
@chuwy
chuwy / ec2mock.py
Last active September 29, 2015 15:02
Stupid EC2 instance info mock
#!/usr/bin/python3
"""
Stupid EC2 meta data instance mock
Save this file as server.py
>>> python server.py 0.0.0.0 8001
serving on 0.0.0.0:8001
or simply
{
"meta-data" : {
"ami-id" : "ami-d05e75b8",
"ami-launch-index" : "0",
"ami-manifest-path" : "(unknown)",
"block-device-mapping" : {
"ami" : "/dev/sda1",
"root" : "/dev/sda1"
},
"hostname" : "ip-172-31-9-37.ec2.internal",
@chuwy
chuwy / ec2.json
Last active October 1, 2015 12:41
{
"ami-id" : "ami-d05e75b8",
"ami-launch-index" : "0",
"ami-manifest-path" : "(unknown)",
"block-device-mapping" : {
"ami" : "/dev/sda1",
"root" : "/dev/sda1"
},
"hostname" : "ip-172-31-9-37.ec2.internal",
"instance-action" : "none",
{
"privateIp" : "172.31.9.37",
"devpayProductCodes" : null,
"availabilityZone" : "us-east-1c",
"version" : "2010-08-31",
"accountId" : "252193496797",
"instanceId" : "i-8297a757",
"billingProducts" : null,
"instanceType" : "t2.micro",
"pendingTime" : "2015-09-29T11:00:50Z",
# -*- coding: utf-8 -*-
import os
gettext = lambda s: s
PROJECT_DIR = os.path.abspath(os.path.dirname(__file__))
DEBUG = True
TEMPLATE_DEBUG = DEBUG
@chuwy
chuwy / .gitignore
Created June 16, 2012 10:55 — forked from starenka/.gitignore
fabfile to deploy flask app to nginx/supervisor/uwsgi stack
.idea/*
*.pyc
C:\"Program Files"\Oracle\VirtualBox\VBoxManage.exe startvm Ubuntu
timeout 30
net use X: \\chuwy-ubuntu\home /user:user pass