Skip to content

Instantly share code, notes, and snippets.

Avatar

Fuminori Sakamoto goldeneggg

View GitHub Profile
View benchstat-vs-latest-remove-interface
name old time/op new time/op delta
pkg:github.com/goldeneggg/structil goos:linux goarch:amd64
NewFinder_Val 831ns ± 2% 971ns ± 4% +16.84% (p=0.008 n=5+5)
NewFinder_Val-2 831ns ± 5% 931ns ± 9% +11.98% (p=0.008 n=5+5)
NewFinder_Ptr 738ns ± 3% 779ns ± 1% +5.53% (p=0.008 n=5+5)
NewFinder_Ptr-2 778ns ± 6% 813ns ±12% ~ (p=0.421 n=5+5)
ToMap_1FindOnly 437ns ± 3% 405ns ± 3% -7.41% (p=0.008 n=5+5)
ToMap_1FindOnly-2 430ns ± 4% 426ns ± 6% ~ (p=0.587 n=5+5)
ToMap_2FindOnly 541ns ± 2% 574ns ± 4% +6.10% (p=0.008 n=5+5)
ToMap_2FindOnly-2 559ns ± 4% 580ns ± 2% ~ (p=0.103 n=5+5)
View hoge.go2
package main
import "fmt"
func Print(type T)(s []T) {
for _, v := range s {
fmt.Println(v)
}
}
@goldeneggg
goldeneggg / ci.yml
Last active Aug 31, 2020
Rails 6 API Development and GitHub Actions CI with Docker (.github/workflows/ci.yml)
View ci.yml
on:
push:
branches:
- master
paths-ignore:
- '**/*.md'
- 'LICENSE'
pull_request:
paths-ignore:
- '**/*.md'
@goldeneggg
goldeneggg / docker-compose.yml
Last active May 27, 2020
Rails 6 API Development and GitHub Actions CI with Docker (docker-compose.yml)
View docker-compose.yml
version: "3.7"
services:
db:
image: mysql:8.0.20
command: --default-authentication-plugin=mysql_native_password
environment:
- MYSQL_ROOT_PASSWORD
- MYSQL_ALLOW_EMPTY_PASSWORD
volumes:
@goldeneggg
goldeneggg / Dockerfile
Last active Jul 8, 2020
Rails 6 API Development and GitHub Actions CI with Docker (Dockerfile)
View Dockerfile
ARG ARG_RUBY_VERSION
FROM ruby:${ARG_RUBY_VERSION}-alpine3.11
# hadolint ignore=DL3008,DL3018
RUN apk update && \
apk add --update --no-cache \
build-base \
bash \
curl \
View benchcmp.txt
benchmark old ns/op new ns/op delta
BenchmarkNewFinder_Val 573 595 +3.84%
BenchmarkNewFinder_Ptr 490 499 +1.84%
BenchmarkToMap_1FindOnly 450 456 +1.33%
BenchmarkToMap_2FindOnly 569 592 +4.04%
BenchmarkToMap_1Struct_1Find 585 616 +5.30%
BenchmarkToMap_1Struct_1Find_2Pair 975 976 +0.10%
BenchmarkToMap_2Struct_1Find 774 807 +4.26%
BenchmarkToMap_2Struct_2Find 972 986 +1.44%
BenchmarkNewFinderKeys_yml 116493 113303 -2.74%
@goldeneggg
goldeneggg / bench_uniq_reject.rb
Last active Jun 28, 2020
[ruby] 一覧から重複削除してnilを除去、の実装方法別パフォーマンス比較
View bench_uniq_reject.rb
require 'benchmark/ips'
require 'benchmark/memory'
require 'set'
CLASSES = [
Class.new {
@arr = ['1', '2', '33', '444', nil, '5555', nil, '444', '66666', 'abcde', '777777', nil, 'XXXX', '33', 'zzzzzzzzzz']
def self.label
@goldeneggg
goldeneggg / app.js
Last active Dec 7, 2018
AWS Lambdaの言語サポート状況を取得する為のLambda Function
View app.js
const axios = require('axios');
const cheerio = require('cheerio');
const url = 'https://docs.aws.amazon.com/ja_jp/lambda/latest/dg/lambda-runtimes.html';
let $;
let response;
/**
@goldeneggg
goldeneggg / kh2md.rb
Last active May 22, 2018
Kindle highlights to markdown for amazon.co.jp
View kh2md.rb
# Note:
# tagged version of kindle-highlights gem is not supported "root_url" option.
# So should use "master" branch version.
require "kindle_highlights"
puts "START kindle highlights output to markdown"
kindle = KindleHighlights::Client.new(email_address: ENV['KINDLE_EMAIL'], password: ENV['KINDLE_PASSWD'], root_url: 'https://read.amazon.co.jp')
kindle.books.each_with_index do |book, i|
puts "========== TITLE: #{book.title}"
@goldeneggg
goldeneggg / sslrails
Created Jul 4, 2016
ローカルのrailsをオレオレ証明書でSSL化して起動する `sslrails` コマンド
View sslrails
#!/usr/bin/env ruby
APP_PATH = File.expand_path('../../config/application', __FILE__)
require_relative '../config/boot'
require 'rubygems'
require 'rails/commands/server'
require 'rack'
require 'webrick'
require 'webrick/https'
You can’t perform that action at this time.