Skip to content

Instantly share code, notes, and snippets.

View ueokande's full-sized avatar
🙆‍♀️
LGTM

Shin'ya Ueoka ueokande

🙆‍♀️
LGTM
View GitHub Profile
@ueokande
ueokande / print-rowkey
Created May 18, 2017 03:25
Print rowkey
#!/usr/bin/env ruby
utsname = []
topic = []
if ARGV.length < 1
STDERR.puts("Missing arguments")
exit 1
end
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
(1..2).each do |n|
config.vm.define "ap-#{n}" do |node|
node.vm.provider "docker" do |docker|
docker.build_dir = "vanilla"
docker.expose = [8000, 12201]

bootstrap.servers

A list of host/port pairs to use for establishing the initial connection to the Kafka cluster. The client will make use of all servers irrespective of which servers are specified here for bootstrapping—this list only impacts the initial hosts used to discover the full set of servers. This list should be in the form host1:port1,host2:port2,.... Since these servers are just used for the initial connection to discover the full cluster membership (which may change dynamically), this list need not contain the full set of servers (you may want more than one, though, in case a server is down).

key.deserializer

Deserializer class for key that implements the Deserializer interface.

value.deserializer

@ueokande
ueokande / leader-election-with-etcd.sh
Last active January 25, 2018 13:13
Leader election with etcd
#!/bin/sh
ID=$(uuidgen)
LEADER_KEY="localhost:2379/v2/keys/master"
TTL=5
INTERVAL=1
i_am_leader() {
echo "I am leader";
while true; do
@ueokande
ueokande / shell-ip-address
Last active June 18, 2024 18:26
Calculating network addresses in tthe shell script
#!/bin/sh
# converts IPv4 as "A.B.C.D" to integer
# ip4_to_int 192.168.0.1
# => 3232235521
ip4_to_int() {
IFS=. read -r i j k l <<EOF
$1
EOF
echo $(( (i << 24) + (j << 16) + (k << 8) + l ))
xwininfo
ffmpeg -video_size ${w}x${height} -framerate 12 -f x11grab -i :0.0+${x},${y} output/%04d.png
@ueokande
ueokande / main.go
Created August 27, 2018 05:14
etcd test
package main
import (
"context"
"fmt"
"os"
"time"
"github.com/coreos/etcd/clientv3"
)
@ueokande
ueokande / start.sh
Created August 29, 2018 12:43
Screencast on Linux
sudo modprobe v4l2loopback
ffmpeg -video_size 3840x2160 -framerate 30 -f x11grab -i :0.0 -f v4l2 /dev/video0
@ueokande
ueokande / main.go
Created June 6, 2019 04:50
Convert tab-splitted dictionaly to json
package main
import (
"bufio"
"encoding/json"
"errors"
"fmt"
"os"
"strings"
)
struct Document<'a> {
fields: Vec<Box<Field + 'a>>,
}
impl<'a> Document<'a> {
fn new() -> Document<'a> {
Document { fields: Vec::new() }
}
fn add_field<T>(&mut self, field: T)