Skip to content

Instantly share code, notes, and snippets.

@puma007
puma007 / counter.rb
Created March 10, 2013 14:26 — forked from oza/counter.rb
require 'sinatra'
require 'dalli'
require 'json'
get '/count' do
res = ''
services = JSON.parse(ENV['VCAP_SERVICES'])
credentials = services["memcached-1.4.10"].first["credentials"]
host = credentials['host']
package com.kaishengit.util;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
public class DateUtil {
public static String getNiceDate(String dateString) {
String result = dateString;
/*
* Copyright (C) 2014 Antonio Leiva Gordillo.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
/*
* Copyright (C) 2014 Chris Banes
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
// These two need to be declared outside the try/catch
// so that they can be closed in the finally block.
HttpURLConnection urlConnection = null;
BufferedReader reader = null;
// Will contain the raw JSON response as a string.
String forecastJsonStr = null;
try {
// Construct the URL for the OpenWeatherMap query
import com.google.auto.value.AutoValue;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
* Marks an {@link AutoValue @AutoValue}-annotated type for proper Gson serialization.
* <p>
/*
* Copyright 2014 Chris Banes
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@puma007
puma007 / vpn.sh
Last active August 29, 2015 14:13 — forked from hongjiang/vpn.sh
#!/bin/bash
PROG_NAME=$0
ACTION=$1
usage() {
echo "Usage: $PROG_NAME {list|ping|optimal|conn|close|status}"
exit 1
}
@puma007
puma007 / revprox.go
Last active August 29, 2015 14:26 — forked from JalfResi/revprox.go
Simple reverse proxy in Go
package main
import(
"log"
"net/url"
"net/http"
"net/http/httputil"
)
func main() {
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os.path
import re
import sys
import tarfile
import numpy as np