Skip to content

Instantly share code, notes, and snippets.

View utky's full-sized avatar

Imamura Yutaka utky

  • Japan
View GitHub Profile
@utky
utky / run_ebpf_socket_filter_main.rs
Created July 19, 2020 13:04
Just pass all ethernet packets from lo device
use libc::{
c_char,
c_int,
c_long,
c_ushort,
c_void,
sockaddr,
sockaddr_ll,
socklen_t,
};
@utky
utky / simplenote-json2evernote.scm
Last active July 13, 2020 14:38
convert exported Simplenote JSON to Evernote export markup (tested with Gauch Scheme 0.9.9)
(use rfc.json)
(use srfi-19)
(define (title-line content)
(car (string-split content "\r\n")))
(define (markup-enml content)
(string-join
(map
(lambda (c)
@utky
utky / ShapingAwsS3Client.java
Created April 18, 2020 17:04
(動作未確認) https://github.com/aws/aws-sdk-java-v2/issues/37 を待たずに自前で転送帯域を制御すべくNetty側のHTTPクライアントにhandlerを追加する。
package ilyaletre;
import io.netty.channel.ChannelFactory;
import io.netty.channel.EventLoopGroup;
import io.netty.handler.traffic.GlobalChannelTrafficShapingHandler;
import software.amazon.awssdk.services.s3.S3AsyncClient;
import software.amazon.awssdk.http.nio.netty.NettyNioAsyncHttpClient;
import software.amazon.awssdk.core.client.builder.SdkAsyncClientBuilder;
import software.amazon.awssdk.http.async.SdkAsyncHttpClient;
@utky
utky / docker-compose.yml
Created March 28, 2020 03:18
locust examples by docker-compose
version: '3'
services:
web:
image: nginx:latest
ports:
- "80:80"
networks:
- perf
slave:
image: locustio/locust
@utky
utky / get_link_info.c
Created September 1, 2019 12:03
Example which communicates with Linux Netlink subsystem to fetch interface information
@utky
utky / Makefile.init-kubeadm
Created September 24, 2018 12:18
Installation steps for kubeadm by Makefile
.PHONY: setup-apt-ext install-kube-repo install-kube-repo update-repo install-kubernetes
KUBE_VERSION=1.10.5-00
KUBE_REPO_LIST=/etc/apt/sources.list.d/kubernetes.list
all: install-kubernetes
setup-apt-ext:
sudo swapoff -a
sudo apt-get update && sudo apt-get install -y apt-transport-https
@utky
utky / main.go
Created December 21, 2017 03:22
Slack client example
package main
import (
"fmt"
"github.com/nlopes/slack"
"os"
)
func printUsers(api *slack.Client) {
users, err := api.GetUsers()
@utky
utky / Vagrantfile-linux-kernel
Created March 25, 2017 02:16
Vagrantfile for viewing, patching, building linux-kernel
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
@utky
utky / get-go-cross-compiler-with-nix.md
Created January 23, 2017 04:09
procedure to enable go cross compile

Install system wide go

nix-env -iA ....

Download source code and compile it

Download

mkdir -p ${GOPATH}/bootstrap

tar xzf .... -C ${GOPATH}/bootstrap

@utky
utky / Main.elm
Created November 13, 2016 04:12
Elm Http Stub
module Main exposing (main)
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.App
import Html.Events exposing (..)
import Http
import Task
-- MODEL