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
// Import built-in Node.js libraries | |
const http = require('http'); | |
const { setTimeout } = require('timers/promises'); // Used to set a delay | |
// Create the server | |
const server = http.createServer(async (req, res) => { | |
// Check if it's a GET request | |
if (req.method === 'GET' && req.url === '/') { | |
// Wait for 5 seconds | |
await setTimeout(5000); |
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
import java.io.*; | |
import javax.net.ssl.*; | |
/* | |
* This example demostrates how to use a SSLSocket as client to | |
* send a HTTP request and get response from an HTTPS server. | |
* It assumes that the client is not behind a firewall | |
* https://docs.oracle.com/javase/10/security/sample-code-illustrating-secure-socket-connection-client-and-server.htm | |
* | |
* Usage: |
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
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
package main | |
import ( | |
"crypto/x509" | |
"encoding/pem" | |
"io/ioutil" | |
"log" | |
"os" | |
) |
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; |
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 '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
#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"] |
NewerOlder