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 test; | |
import java.io.IOException; | |
import java.util.concurrent.atomic.AtomicLong; | |
import java.util.zip.GZIPOutputStream; | |
import javax.servlet.http.HttpServletResponse; | |
import org.springframework.web.bind.annotation.RequestMapping; | |
import org.springframework.web.bind.annotation.RequestParam; |
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
# group tickets to users | |
group_tickets = (msg, results) -> | |
if results.count <= 0 | |
return | |
assigned_tickets = {} | |
unassinged = 0 | |
for result in results | |
if result.assignee_id? | |
assignee_id = result.assignee_id |
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
var data_collection; | |
for (var i in jsonbody.rest) | |
{ | |
jsonbody.rest[i]["savedtime"] = new Date().toISOString(); | |
data_collection.save(jsonbody.rest[i] , function(err, saved) { | |
if( err || !saved ) console.log("Rest not saved: " + err); | |
else ; | |
}); |
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
#Profile | |
web: uwsgi --http :$PORT --wsgi-file hello-tdeng.py | |
#hello.py | |
def application(env, start_response): | |
start_response('200 OK', [('Content-Type','text/html')]) | |
return [b"Hello World"] |
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 '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, |
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
--- | |
applications: | |
- name: redispubsub | |
memory: 256M | |
instances: 4 | |
host: <any unique string here> | |
path: ./ | |
buildpack: nodejs_buildpack | |
services: | |
- redis-instance |
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
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; |
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 'net/http' | |
require 'uri' | |
def func | |
uri = URI.parse("http://test-target.cfapps-11.haas-59.pez.pivotal.io") | |
response = Net::HTTP.get_response(uri) | |
end | |
$i = 0 | |
$num = 150000 |
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
$ brew update | |
$ brew cask install minikube | |
$ brew install kubernetes-cli | |
$ brew install docker-machine-driver-hyperkit | |
# docker-machine-driver-xhyve need root owner and uid | |
$ sudo chown root:wheel $(brew --prefix)/opt/docker-machine-driver-hyperkit/bin/docker-machine-driver-hyperkit | |
$ sudo chmod u+s $(brew --prefix)/opt/docker-machine-driver-hyperkit/bin/docker-machine-driver-hyperkit | |
$ minikube start --logtostderr --vm-driver=hyperkit |
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 dev.tdeng.onlinechat; | |
import java.io.IOException; | |
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; |
OlderNewer