Skip to content

Instantly share code, notes, and snippets.

View youknowcast's full-sized avatar

Hideki Ambe youknowcast

View GitHub Profile
@youknowcast
youknowcast / Dockerfile
Last active October 26, 2023 17:53
active_record_gem.rb on Docker
FROM ruby:3.2.2-slim-bullseye
RUN apt-get update -qq && apt-get install -y sqlite3 libsqlite3-dev build-essential vim locales
RUN gem install bundler
RUN sed -i -E 's/# (ja_JP.UTF-8)/\1/' /etc/locale.gen && locale-gen
ENV LANG ja_JP.UTF-8
WORKDIR /app
@youknowcast
youknowcast / docker-compose.yml
Last active November 14, 2023 02:25
local environment(mysql + postgres + adminer)
version: '3.1'
services:
mysql-db:
image: mysql:8.1.0
# NOTE: use of "mysql_native_password" is not recommended: https://dev.mysql.com/doc/refman/8.0/en/upgrading-from-previous-series.html#upgrade-caching-sha2-password
# (this is just an example, not intended to be a production configuration)
command: --default-authentication-plugin=mysql_native_password
restart: always
environment:
# frozen_string_literal: true
require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
# Activate the gem you are reporting the issue against.
@youknowcast
youknowcast / aa.exs
Last active March 11, 2023 17:54
3,4,7,8 を使って 10 を作る
defmodule Calculator do
def calc() do
tests()
end
defp tests() do
val_permutation()
|> Enum.map(fn v ->
expr_product()
|> Enum.map(fn x ->
@youknowcast
youknowcast / application.rb
Created August 5, 2022 17:34
show image at onsubmit
class Application
def call(env)
sleep 5
[200, { "Content-Type" => "text/html" }, [File.read('public.html')]]
end
end
tap "github/gh"
tap "hashicorp/tap"
tap "homebrew/bundle"
tap "homebrew/cask"
tap "homebrew/core"
tap "kayac/tap"
brew "automake"
brew "coreutils"
brew "asdf"
brew "awscli"
@youknowcast
youknowcast / ulid.go
Last active May 13, 2021 03:39
To use golang Mutex
package main
import (
"fmt"
"sync"
)
func main() {
InitUlidGenerator(nil)
% go run ulid/ulid.go
Unixtime with nanosec
01F3W0VG46FH5P40MEEY68ME80
01F3W0VG467PHG5QEV57V2K7PF
01F3W0VG46GSWCC2GEC8G0N3WW
01F3W0VG46PX26DX5B59Q2GPX3
Unixtime with sec
01F3W0VG0GAH38AX7EJ2NJ557A
01F3W0VG0GAH38AX7EJ2NJ557A
01F3W0VG0GAH38AX7EJ2NJ557A
@youknowcast
youknowcast / code.gs
Last active May 10, 2021 05:02
fivefinger-app 用 GAS コード
function getUsers() {
const appProps = PropertiesService.getDocumentProperties()
const usersStr = appProps.getProperty('users')
const users = JSON.parse(usersStr)
return users
}
function setUsers(users) {
const appProps = PropertiesService.getDocumentProperties()
appProps.setProperty('users', JSON.stringify(users))
@youknowcast
youknowcast / Dockerfile
Last active March 26, 2021 04:26
ULID と JSON 型の動作確認スクリプト
FROM mysql
#ポートを開ける
EXPOSE 3306
#MySQL設定ファイルをイメージ内にコピー
ADD ./my.cnf /etc/mysql/conf.d/my.cnf
#docker runに実行される
CMD ["mysqld"]