Skip to content

Instantly share code, notes, and snippets.

View niku's full-sized avatar
💭
🍖

KITAMURA Daisuke niku

💭
🍖
View GitHub Profile
@niku
niku / .README.md
Last active February 17, 2024 20:48
a sample repository of prop_check with test-unit

This repository is working sample of prop_check with test-unit.

$ ruby run_test.rb
Loaded suite 6dec8e397943cdc372b969fff26299e7
Started
E
================================================================================================================================================
Error: test_that_it_returns_an_integer_for_any_input(TestNaiveAverage):
 ZeroDivisionError:
@niku
niku / .gitignore
Last active December 23, 2023 12:19
a sample repository of prop_check with rspec
#
@niku
niku / go.mod
Last active December 21, 2021 14:04
Make buckets has no object even if the bucket is versioning-enabled
module niku/cleanup-version-enabled-bucket
go 1.17
require (
github.com/aws/aws-sdk-go-v2 v1.11.2
github.com/aws/aws-sdk-go-v2/config v1.11.0
github.com/aws/aws-sdk-go-v2/service/s3 v1.21.0
)
@niku
niku / expect_spec.rb
Created March 15, 2011 15:41
How do I use expect{}.to change().from().to() on Array?
require 'rspec'
class Int
attr_reader :count
def initialize
@count = 0
end
def increment
@count += 1
end
@niku
niku / mix.exs
Created February 2, 2017 12:07
ecto_sandbox
defmodule EctoSandbox.Mixfile do
use Mix.Project
def project do
[app: :ecto_sandbox,
version: "0.1.0",
elixir: "~> 1.4",
build_embedded: Mix.env == :prod,
start_permanent: Mix.env == :prod,
elixirc_paths: ["."],
# 比較用
# https://elixir-lang.org/getting-started/mix-otp/task-and-gen-tcp.html
defmodule KVServer do
require Logger
@doc """
Starts accepting connections on the given `port`.
"""
def accept(port) do
{:ok, socket} = :gen_tcp.listen(port,
{
"make equality properly": {
"prefix": "eq",
"body": [
"@override",
"bool operator ==(Object other) =>",
" identical(this, other) ||",
" other is $1 &&",
" runtimeType == other.runtimeType${2/ ([^ ]+)/ && ${1} == other.${1}/g};",
"",
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@niku
niku / instructions.md
Last active January 21, 2020 04:28
How to get a runtime_info as a file
❯ iex
Erlang/OTP 22 [erts-10.6.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe]

Interactive Elixir (1.10.0-rc.0) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> file = File.open!("./runtime_info.txt", [:write])
#PID<0.110.0>
iex(2)> original_group_leader = Process.group_leader()
#PID<0.64.0>
iex(3)> Process.group_leader(self(), file)
/tmp $ git clone https://github.com/msantos/procket.git
/tmp $ cd procket/
/tmp/procket $ rebar3 compile
# The compile should be succeed
## Add new module
/tmp/procket $ echo '-module(hello).
-export([hello_world/0]).
hello_world() -> io:fwrite("hello, world\n").' > src/hello.erl