Skip to content

Instantly share code, notes, and snippets.


Tao Deng devtdeng

  • Pivotal
  • Paris, France
View GitHub Profile
View gist:eccbe119fb0652ff111b
package test;
import java.util.concurrent.atomic.AtomicLong;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
View gist:18cc99467c02ff3c28e8
# group tickets to users
group_tickets = (msg, results) ->
if results.count <= 0
assigned_tickets = {}
unassinged = 0
for result in results
if result.assignee_id?
assignee_id = result.assignee_id
View gist:1d49652cd45f7177a09e
var data_collection;
for (var i in
{[i]["savedtime"] = new Date().toISOString();[i] , function(err, saved) {
if( err || !saved ) console.log("Rest not saved: " + err);
else ;
View gist:bf655c74e5fb27715d0b25f619fa8d05
web: uwsgi --http :$PORT --wsgi-file
def application(env, start_response):
start_response('200 OK', [('Content-Type','text/html')])
return [b"Hello World"]
devtdeng / image.rb
Last active Jul 4, 2016
Edit /home/tempest-web/.bosh_init/installations/<guid>/packages/bosh_openstack_cpi/vendor/bundle/ruby/2.1.0/gems/fog-1.34.0/lib/fog/openstack/image.rb or replace it with this one, please keep file owner/group/permission unchanged. Raw Raw
View image.rb
require 'fog/openstack/core'
module Fog
module Image
class OpenStack < Fog::Service
SUPPORTED_VERSIONS = /v1(\.(0|1))*/
requires :openstack_auth_url
recognizes :openstack_auth_token, :openstack_management_url,
:persistent, :openstack_service_type, :openstack_service_name,
View test.js
var serverName = process.env.VCAP_APP_HOST ? process.env.VCAP_APP_HOST + ":" + process.env.VCAP_APP_PORT : 'localhost:3000';
var serverName = process.env.CF_INSTANCE_IP + ":" + process.env.CF_INSTANCE_PORT;
var sub = redis.createClient();
var pub = redis.createClient();
var vcap_services_object = JSON.parse(process.env.VCAP_SERVICES);
var host = vcap_services_object.rediscloud[0].credentials.hostname;
View manifest.yml
- name: redispubsub
memory: 256M
instances: 4
host: <any unique string here>
path: ./
buildpack: nodejs_buildpack
- redis-instance
devtdeng /
Last active Apr 17, 2017
RabbitMQ Java Client Sample
package dev.tdeng.onlinechat;
import com.rabbitmq.client.AMQP;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;
import com.rabbitmq.client.Consumer;
import com.rabbitmq.client.DefaultConsumer;
devtdeng / verify_certificate.go
Last active Mar 3, 2020
Verify a certificate with chain with golang crypto library
View verify_certificate.go
package main
import (
View load_test.rb
require 'net/http'
require 'uri'
def func
uri = URI.parse("")
response = Net::HTTP.get_response(uri)
$i = 0
$num = 150000
You can’t perform that action at this time.