Skip to content

Instantly share code, notes, and snippets.

@walf443
walf443 / log.txt
Created August 14, 2023 06:59
k0s debian_12 ostest log
TF_VAR_os=debian_12 terraform apply
module.k0sctl.data.http.k0s_version[0]: Reading...
module.k0sctl.data.http.k0s_version[0]: Read complete after 0s [id=https://docs.k0sproject.io/stable.txt]
module.infra.data.aws_availability_zones.available: Reading...
module.infra.data.aws_vpc.default: Reading...
module.os.data.aws_ami.debian_12[0]: Reading...
module.infra.data.aws_availability_zones.available: Read complete after 0s [id=ap-northeast-1]
module.os.data.aws_ami.debian_12[0]: Read complete after 0s [id=ami-0bef69e9bf0a285ef]
module.infra.data.aws_ec2_instance_type_offerings.in_available_azs["t3a.small"]: Reading...
module.infra.data.aws_ec2_instance_type_offerings.in_available_azs["t3a.small"]: Read complete after 1s [id=ap-northeast-1]
@walf443
walf443 / serialize_interface.kt
Last active September 11, 2017 11:27
interfaceをSerializableにして問題ないか検証してみた
import java.io.*
interface OnClickListener: Serializable {
fun onClick()
}
fun main(args: Array<String>) {
val l: OnClickListener = object: OnClickListener {
override fun onClick() {
println("\nhello kt")
@walf443
walf443 / gist:641b37d280b75e1d0d64
Created September 3, 2015 11:38
run callback only in 200ms
window.requestIdleCallback(function(d) { for (i = 0; i < 1000000; i++) { if ( d.timeRemaining() == 0 ) { return } else { console.log([d.timeRemaining(), d.didTimeout]) } } }, 200)
@walf443
walf443 / gist:09d0d0136021d6bf903c
Last active August 29, 2015 14:26
benchmark SIMD.js
function benchmark(title, iteration, callback) { start = performance.now(); for (i = 0; i < iteration; i++ ) { callback(); }; end = performance.now(); console.log("%s: time: %f, average: %f", title, end - start, ( end - start ) / iteration); }
function benchmarkSIMD(iteration) {
console.log(navigator.userAgent);
let a = SIMD.Float32x4(1, 2, 3, 4);
let b = SIMD.Float32x4(2,3,4,5);
let aa = [1,2,3,4];
let bb = [2,3,4,5];
benchmark("add SIMD", iteration, function() { return SIMD.Float32x4.add(a, b) });
benchmark("add", iteration, function() {
@walf443
walf443 / gist:5f3a7311a1d66ac4f94c
Last active August 29, 2015 14:05
config/routes.rbを別ファイルへ分割したい
module SomeModule
def self.apply(context)
context.instance_exec do
# 実行させたい処理を書く
end
end
end
Your::Application.routes.draw do
SomeModule.apply(self)
require 'dalli'
dalli = Dalli::Client.new("localhost:11211")
p dalli.set("foo", 1)
p dalli.get("foo")
10.times do
pid = Process.fork do
# dalli.reset
@walf443
walf443 / check_conflict.sh
Last active December 18, 2015 10:49
check_conflict.sh
#!/bin/bash
exec 1>&2
git status --porcelain | cut -f3 -d ' ' | xargs -I% cat % | grep -A 3 -B 3 '<<<<< HEAD' && echo "********************** WARNING ***********************" && echo " CONFLICT MARKER FOUND" && echo "******************************************************" && exit 1
exit 0
@walf443
walf443 / try_cpanm.pl
Created February 20, 2013 14:01
trying cpanm if got "Can't localte xxx.pm"
use strict;
use warnings;
use Capture::Tiny ':all';
sub main {
my @args = @_;
my $stderr = do_try(@args);
while (1) {
if ( $stderr && $stderr =~ /Can't locate (.+?)\.pm / ) {
my $file = $1;
@walf443
walf443 / gist:4720091
Created February 6, 2013 03:50
nested definitions in ruby?
def hoge
p def fuga
p "called fuga"
end
fuga
end
hoge
fuga
*[git]origin/masterへmergeずみのリモートブランチをまとめてお掃除したい。
** まとめ
>||
$ git fetch --prune
$ git fetch
$ git branch -r --merged origin/master | grep -v origin/master | sed -e 's/origin\//:/' | xargs echo git push origin
||<