Skip to content

Instantly share code, notes, and snippets.

View gist:efd158a059432d5e7618011a2edfbc5d
#!/bin/bash
TENANT_NAME=
ADMIN_USERNAME=
ADMIN_PASSWORD=
REQUEST="{\"auth\": {\"tenantName\":\"$TENANT_NAME\", \"passwordCredentials\": {\"username\": \"$ADMIN_USERNAME\", \"password\": \"$ADMIN_PASSWORD\"}}}"
RAW_TOKEN=`curl -s -d "$REQUEST" -H "Content-type: application/json" "http://{KeyStone_IP_ADDR:Port}/v2.0/tokens"`
TOKEN=`echo $RAW_TOKEN | python -c "import sys; import json; tok = json.loads(sys.stdin.read()); print tok['access']['token']['id'];"`
echo $TOKEN\
View gist:ca7771b02042d0cabc99cf941684c0e1
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <unistd.h>
#include <netinet/in.h>
#include <arpa/inet.h>
View gist:d398d0ec3c0349248874c055942b4403
while (1) {
time = zv_find_timer();
debug("wait time = %d", time);
n = zv_epoll_wait(epfd, events, MAXEVENTS, time);
zv_handle_expire_timers();
log_info("loop n:%d\n",n);
for (i = 0; i < n; i++) {
zv_http_request_t *r = (zv_http_request_t *)events[i].data.ptr;
fd = r->fd;
log_info("fd:%d\n", fd);
You can’t perform that action at this time.