Skip to content

Instantly share code, notes, and snippets.

'use strict';
const readline = require("readline");
const fs = require("fs");
const {spawn} = require("child_process");
//<flag 2byte><timestamp 4><addr 4><mask 4><asn 4>
const packEvent = ev => {
const buf = Buffer.alloc(18, 0);
const timestamp = +new Date/1000|0;
@zaftzaft
zaftzaft / 4div.py
Last active April 22, 2018 05:30
画像を分割するやつ
import sys
from PIL import Image
im = Image.open(sys.argv[1])
(w, h) = im.size
im.crop((0, 0, w/2, h/2)).save("f/a.png")
im.crop((w/2, 0, w, h/2)).save("f/b.png")
#include <time.h>
#include <stdio.h>
int main(void) {
printf("time_t: %d\n", sizeof(time_t));
printf("long: %d\n", sizeof(long));
printf("timespec: %d\n", sizeof(struct timespec));
return 0;
}
@zaftzaft
zaftzaft / traf.sh
Created May 29, 2018 11:48
instant traffic monitor
#!/bin/bash
dev=$1
b=0
while :
do
a=`cat /proc/net/dev | grep $dev | sed "s/\s\{1,\}/ /g" | cut -d" " -f 11`
#echo $(($a-$b))
byte=`expr $a - $b`
echo `expr $byte \* 8`
[Unit]
Description=Kafka publish-subscribe messaging system
Requires=zookeeper@kafka.service
After=network.target zookeeper@kafka.service
[Service]
ExecStart=/opt/kafka/bin/kafka-server-start.sh /opt/kafka/config/server.properties
[Install]
WantedBy=multi-user.target