Skip to content

Instantly share code, notes, and snippets.

package iprtb
import (
"net"
"testing"
)
func Benchmark_PrefixTreeAlgorithm(b *testing.B) {
rtb := NewRouteTable()
@moznion
moznion / sh-run.sh
Last active January 2, 2022 03:23
A runner script that runs a shell script with putting IMMUTABLE file attribute dynamically.
#!/bin/bash
# usage:
# sh-run.sh script-you-want-to-run.sh args...
set -ue
file="$1"
should_remove_immutable_attr=0
func! s:pm_template()
let path = substitute(expand('%'), '.*lib/', '', 'g')
let path = substitute(path, '[\\/]', '::', 'g')
let path = substitute(path, '\.pm$', '', 'g')
call append(0, 'package ' . path . ';')
call append(1, 'use strict;')
call append(2, 'use warnings;')
call append(3, 'use utf8;')
call append(4, '')
call append(5, '')
@moznion
moznion / instruction.md
Created September 24, 2019 04:47
技術書典7で頒布したATコマンドかるたの取扱説明書です

たのしい! ATコマンドかるた

この度はATコマンドかるたをお買い求めくださいましてありがとうございます。本説明書ではATコマンドかるたの遊び方の説明をいたします。

内容物

  • ATコマンドふだ 48枚
  • 機能ふだ 48枚
  • 説明書 (今読んでおられるものです) 1枚
@moznion
moznion / Dockerfile
Created April 21, 2019 06:38
sshd docker container that allows no password login
FROM debian:stretch-slim
RUN apt-get update && apt-get install -y openssh-server
RUN mkdir /var/run/sshd
RUN echo 'root:root' | chpasswd
RUN useradd -m test
RUN passwd -d test
RUN sed -i'' -e's/^#PermitRootLogin prohibit-password$/PermitRootLogin yes/' /etc/ssh/sshd_config \
&& sed -i'' -e's/^#PasswordAuthentication yes$/PasswordAuthentication yes/' /etc/ssh/sshd_config \
&& sed -i'' -e's/^#PermitEmptyPasswords no$/PermitEmptyPasswords yes/' /etc/ssh/sshd_config \
package net.moznion.javacard.helloworld;
import javacard.framework.*;
import javacardx.framework.*;
public class HelloWorldApplet extends Applet {
private final static byte HELLO_WORLD_CLA = (byte)0xB0;
private final static byte SELECT_INS = (byte)0xA4;
private final static byte HELLO_INS = (byte)0x50;
private final static byte[] HELLO_TEXT = {(byte)'H',(byte)'e',(byte)'l',(byte)'l',(byte)'o'};
@moznion
moznion / docker-compose.yml
Last active May 15, 2018 01:19
docker-compose file for kibana with oauth2_proxy
version: '2.1'
services:
kibana:
image: 'docker.elastic.co/kibana/kibana-oss:6.1.0'
elasticsearch:
image: 'docker.elastic.co/elasticsearch/elasticsearch-oss:6.1.0'
oauth2-proxy:
image: 'a5huynh/oauth2_proxy:2.2'
@moznion
moznion / nginx.conf
Created December 14, 2017 13:44
nginx configuration file for kibana with oauth2_proxy
user nginx;
pid /var/run/nginx.pid;
worker_processes auto;
events {
use epoll;
}
use v6.c;
use Crust::Request;
use JSON::Fast;
sub app($env) {
my $req = Crust::Request.new($env);
given $req.path-info {
when '/' {
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
use feature qw/state say/;
use Data::Validator;
package Foo {
sub build {