When you use JSON to call an API - not a REST API, but something like JSON-RPC - you will usually want to encode one of several possible messages.
Your request body looks like this:
{
"type": "MessageWithA",
This is free and unencumbered software released into the public domain. | |
Anyone is free to copy, modify, publish, use, compile, sell, or | |
distribute this software, either in source code form or as a compiled | |
binary, for any purpose, commercial or non-commercial, and by any | |
means. | |
In jurisdictions that recognize copyright laws, the author or authors | |
of this software dedicate any and all copyright interest in the | |
software to the public domain. We make this dedication for the benefit |
#include <string> | |
#include <dlfcn.h> | |
#include <stdio.h> | |
#include <sys/mman.h> | |
#include <unistd.h> | |
#include <errno.h> | |
#include <stdlib.h> | |
using namespace std::literals; |
Hey everyone - this is not just a one off thing, there are likely to be many other modules in your dependency trees that are now a burden to their authors. I didn't create this code for altruistic motivations, I created it for fun. I was learning, and learning is fun. I gave it away because it was easy to do so, and because sharing helps learning too. I think most of the small modules on npm were created for reasons like this. However, that was a long time ago. I've since moved on from this module and moved on from that thing too and in the process of moving on from that as well. I've written way better modules than this, the internet just hasn't fully caught up.
@broros
otherwise why would he hand over a popular package to a stranger?
If it's not fun anymore, you get literally nothing from maintaining a popular package.
One time, I was working as a dishwasher in a restu
require "http/server" | |
class Users::Me | |
include HTTP::Handler | |
def call(context) | |
return call_next(context) unless match?(context.request) | |
STDOUT.puts "getting user info..." | |
STDOUT.puts "done!" |
Kafka 0.11.0.0 (Confluent 3.3.0) added support to manipulate offsets for a consumer group via cli kafka-consumer-groups
command.
kafka-consumer-groups --bootstrap-server <kafkahost:port> --group <group_id> --describe
Note the values under "CURRENT-OFFSET" and "LOG-END-OFFSET". "CURRENT-OFFSET" is the offset where this consumer group is currently at in each of the partitions.
#!/bin/sh | |
# to run this, use the following: | |
# curl https://matthewbauer.us/kernel-panic.sh | sh | |
cfile=$(mktemp).c | |
cat <<EOF >> $cfile | |
#include <unistd.h> | |
#include <sys/syscall.h> | |
#include <signal.h> |
This is an answer to https://twitter.com/developius/status/892470102632923136 about his SSL with Docker Swarm, Let's Encrypt and Nginx blog post and a way to not kill Nginx for certificate generation/renewal.
(from what I read in the blog post)
/etc/letsencrypt
directory so that certificates are on the host and not on the container.package main | |
import ( | |
"bytes" | |
"crypto/aes" | |
"crypto/cipher" | |
"crypto/rand" | |
"errors" | |
"io" | |
"io/ioutil" |
#!/bin/bash | |
# This awk/sed script looks for "gs://bucket/path/filename" and "Hash (md5)", | |
# swaps the two (so the hash appears before the file, in the md5sum format), | |
# cuts out the "gs://bucket/" name, and finally converts the md5 hash | |
# from base64 to hex. This allows for later off-line file integrity check | |
# via the standard "md5sum -c". | |
# | |
# To use it, either save it as an alias or a shell script, and pipe the | |
# output of gsutil ls -L through it. For example, save it as "md5convert.sh" | |
# and then run "gsutil ls -L gs://bucket/path | bash md5convert.sh" |