Instantly share code, notes, and snippets.
Software Entropy Reducer. Loves Go and Kubernetes.Most of my works exist in@cybozu and@cybozu-go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
package main | |
import ( | |
"os" | |
networkingv1beta1"k8s.io/api/networking/v1beta1" | |
"k8s.io/apimachinery/pkg/runtime/serializer/json" | |
"k8s.io/client-go/kubernetes/scheme" | |
) |
ymmt2005 /ecmp_weird_route.sh
Last activeMay 16, 2018 01:12
Test Linux weird behavior on ECMP routes This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
#!/bin/sh -e | |
NS=testns | |
BR1=testbr1 | |
VETH1=testveth1 | |
BR2=testbr2 | |
VETH2=testveth2 | |
LINKS="$VETH1$VETH2$BR1$BR2" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Ubuntu VM ディスクイメージを gzip, Zstd, Brotli で圧縮 | |
$ time lzop -d < vm-generic.lzo | gzip > vm-generic.gz | |
real 0m44.422s | |
user 0m46.736s | |
sys 0m1.312s | |
$ time lzop -d < vm-generic.lzo | zstd > vm-generic.zstd | |
real 0m9.863s | |
user 0m10.336s |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
fromargparseimportArgumentParser | |
importos | |
fromos.pathimportdirname,realpath | |
fromtempfileimportNamedTemporaryFile | |
defsyncdir(d:str): | |
fd=os.open(d,os.O_RDONLY|os.O_DIRECTORY) | |
os.fsync(fd) |
ymmt2005 /annotate-id-ns.py
Last activeOctober 9, 2015 00:21
Annotate "nvme id-ns -b" output tersely. This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from __future__importprint_function | |
fromargparseimportArgumentParser,RawDescriptionHelpFormatter | |
importre | |
importsys | |
# Constants | |
HELP_DESCRIPTION= '''\ | |
Annotateid-nsoutputforhumans. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
diff -ruN debian-installer-20101020ubuntu318.15.orig/build/boot/x86/syslinux.cfg debian-installer-20101020ubuntu318.15/build/boot/x86/syslinux.cfg | |
--- debian-installer-20101020ubuntu318.15.orig/build/boot/x86/syslinux.cfg2014-06-03 23:02:21.000000000 +0000 | |
+++ debian-installer-20101020ubuntu318.15/build/boot/x86/syslinux.cfg2015-04-06 02:21:48.031746385 +0000 | |
@@ -1,5 +1,10 @@ | |
# D-I config version 2.0 | |
include ${SYSDIR}menu.cfg | |
-default ${SYSDIR}vesamenu.c32 | |
+#default ${SYSDIR}vesamenu.c32 | |
+# Cybozu: auto start PXE | |
+default auto |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
// g++ -std=gnu++11 hoge.cpp -lpthread | |
#include<cerrno> | |
#include<chrono> | |
#include<cstring> | |
#include<iostream> | |
#include<netdb.h> | |
#include<sys/socket.h> | |
#include<sys/types.h> | |
#include<system_error> |
NewerOlder