Skip to content

Instantly share code, notes, and snippets.

import akka.actor.ActorSystem
import akka.stream.ActorMaterializer
import akka.stream.scaladsl._
object Main {
implicit val system = ActorSystem()
implicit val materializer = ActorMaterializer()
def tid(): String = f"${Thread.currentThread().getId()}%02d"
def main(args: Array[String]) {
@moccos
moccos / exekill.sh
Created April 16, 2015 15:44
taskkill.exe helper
function exekill() {
if [ "$1" = "" ]; then
echo "exekill: specify exe name (without .exe)"
return
fi
local exe=$1.exe
taskkill /f /im $exe
}
@moccos
moccos / create_repo.sh
Created April 16, 2015 09:46
Initialize a git repository at server.
#!/bin/sh
repo_name=$1
if [ $repo_name = "" ]; then
echo "Specify repo name."
exit -1
fi
dir_name=${repo_name}.git
mkdir $dir_name
#include "stdafx.h"
#include "DxOpenNIMouse.h"
bool DxOpenNIMouse::Init(HWND hWnd, bool EngFlag, LPDIRECT3DDEVICE9 lpDevice, WCHAR *f_path) {
int i;
for (i = 0; i < 15; i++) {
BP_Vector[i].x = 0;
BP_Vector[i].y = DxOpenNIBase::LostVertexY;
BP_Vector[i].z = 0;
}
<match influx.**>
type forest
remove_prefix influx
subtype influxdb
<case **>
host 192.168.1.11
port 8086
dbname test
</case>
</match>
@moccos
moccos / mvln.sh
Last active December 30, 2015 10:09
mv -> ln
function mvln() {
function __mvln() {
local opts=$1
local src=$2
local dst=$3
if [ -d $dst ]; then
# When dst is dir, dst_file must be dir/filename
local file=${src##*/}
mv $opts -- $src $dst && ln -s -- ${dst}/${file} $src
else
@moccos
moccos / nkf.sh
Created February 4, 2015 05:51
全ファイルをnkfに通すだけ
#!/bin/sh
EXT=csv
FILES=`find *.$EXT -name "*_.$EXT" -prune -o -print`
SUFFIX=_
OPTS=
for FILE in $FILES; do
NAME=${FILE%.*}
echo processing $NAME
nkf $OPTS < $FILE > $NAME${SUFFIX}.$EXT
@moccos
moccos / boost_asio_test.cpp
Last active August 29, 2015 14:09
boost asio TCP server snippet. All resources will leak.
#include <stdio.h>
#include <string.h>
#include <memory>
#include <boost/asio.hpp>
static const int PORT = 23455;
static const int BUF_SIZE = 1024 * 4;
static const int UNIT_SIZE = 8;
using namespace boost::asio;
@moccos
moccos / libuv_test.cpp
Last active August 29, 2015 14:08
libuv test code.
#include <uv.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
static const int PORT = 12344;
void alloc_cb(uv_handle_t* handle, size_t suggested_size, uv_buf_t* buf) {
*buf = uv_buf_init((char*)malloc(suggested_size), suggested_size);
}
@moccos
moccos / libev2_test.cpp
Last active May 14, 2018 06:17
Modified libevent / sample / hello-world.c
/*
This exmple program provides a trivial server program that listens for TCP
connections on port 9995. When they arrive, it writes a short message to
each client connection, and closes each connection once it is flushed.
Where possible, it exits cleanly in response to a SIGINT (ctrl-c).
*/
#include <string.h>
#include <errno.h>