Skip to content

Instantly share code, notes, and snippets.

View kachick's full-sized avatar
😋
😪

Kenichi Kamiya kachick

😋
😪
View GitHub Profile
@kachick
kachick / podman-shell.nix
Created March 29, 2024 07:03 — forked from adisbladis/podman-shell.nix
Use podman within a nix-shell
{ pkgs ? import <nixpkgs> {} }:
let
# To use this shell.nix on NixOS your user needs to be configured as such:
# users.extraUsers.adisbladis = {
# subUidRanges = [{ startUid = 100000; count = 65536; }];
# subGidRanges = [{ startGid = 100000; count = 65536; }];
# };
@kachick
kachick / AuthyToOtherAuthenticator.md
Created February 13, 2024 18:56 — forked from gboudreau/AuthyToOtherAuthenticator.md
Export TOTP tokens from Authy

Generating Authy passwords on other authenticators


*update: This might affect how easy it is to use this technique past August 2024: https://www.theverge.com/2024/1/8/24030477/authy-desktop-app-shutting-down


There is an increasing count of applications which use Authy for two-factor authentication. However many users who aren't using Authy, have their own authenticator setup up already and do not wish to use two applications for generating passwords.

Since I use 1Password for all of my password storing/generating needs, I was looking for a solution to use Authy passwords on that. I couldn't find any completely working solutions, however I stumbled upon a gist by Brian Hartvigsen. His post had a neat code with it to generate QR codes for you to use on your favorite authenticator.

@kachick
kachick / ForkMITLicensedProject.md
Created July 1, 2022 13:17 — forked from fbaierl/ForkMITLicensedProject.md
HOWTO fork a MIT licensed project

No, you are not allowed to change the copyright notice. Indeed, the license text states pretty clearly:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

But you are allowed to add a copyright notice.

If you want to keep the MIT license, which is what I would advise you to do, you only need to add a single line to the license file, before or after Copyright (c) 2012 Some Name with your own copyright notice. The final LICENSE file will look like this:

The MIT License (MIT)

@kachick
kachick / 2014-01.md
Last active February 13, 2022 20:02
電子書籍300冊程度自炊した時点での解像度・ファイルフォーマット方針

個人の感想

書籍(文字中心)

  • 300dpでもあんま気にならない。が、技術書(2500~8000円程度?)中心だと総じてコミック(400~1500円程度?)に比べて高価なのでこっちをケチるのもなんだかなーという気はしてしまう。
  • JPEGだと文字のにじみが目立つ
  • 可逆圧縮が効きやすい(サイズがJPEG比で、256色だと1.6~1.7倍程度。16色だと0.8倍程度)
  • 2色しか目立たない様な書籍でも、モノクロスキャンだと違和感を感じる(なんで?濃度?)
  • 白黒だと省かれるみたいだけど、グレースケールだと紙質(ざらざらとか)がそのまま暗さとして反映されたりするっぽい
@kachick
kachick / why_i_dont_like_each_with_object.md
Last active March 14, 2021 17:55
Enumerable#each_with_object が嫌いな理由

Enumerable#each_with_object が嫌いだ。

もちろん動作自体は非常に有益だと思っているので、名前が嫌いなんだなーという結論になってしまうんだけど。

名前が長いというのはまぁそうなんだけど、その事自体は大した問題じゃない。
動作と名前が一致しているなら、後から良い短い名前が見つかった時aliasつければ別に困らない。
このメソッドが嫌いなのは、eachから始まっているところだ。
他のeach[_foo]系はブロック付の時にself返すのに、これだけ引数を返す。
これは類推できない、なので嫌だ。 代案の一つとして、こういうのはどうか

#!/bin/sh
# [scriptname]
# Author: Kenichi Kamiya
# Release:
readonly ereg_pattern_ipv4addr='^([0-9]{1,3}\.){3}[0-9]{1,3}$'
raise_error() {
echo "Error: $@"
@kachick
kachick / building_ruby_trunk_for_chruby.md
Created July 29, 2016 19:14
rubyのtrunkをさっくりbuildしてchrubyから使えるようにする時の僕のやり方

推奨できる物かは知らないけど個人的に楽

Mac OS X + zsh + chruby

ruby_version=$(grep '#define RUBY_VERSION' version.h | grep -o -E '[0-9.]+')
ruby_bin=ruby-${ruby_version}dev.$(git rev-parse --short trunk)
./configure --prefix="$HOME/.rubies/$ruby_bin" --disable-install-doc
make install
source /usr/local/share/chruby/chruby.sh
@kachick
kachick / README.md
Created July 30, 2018 12:34
pg gem のインストール時にpg_config ~ libpq-feでコケたら

TL;DR

gem install pg -v '0.21.0' --source 'https://rubygems.org/' -- --with-pg-config=/usr/local/Cellar/postgresql@9.4/9.4.18/bin/pg_config

こんなエラーが出たときに上記で解消した。

gem install pg -v '0.21.0' --source 'https://rubygems.org/'
@kachick
kachick / use-old-mongodb.md
Last active July 28, 2018 03:27
古いmongodb を MacOSX + homebrew で使う
brew unlink mongodb
brew install homebrew/versions/mongodb32
brew info mongodb
mongod --version
# kill -9 で 古いmongod殺した。
brew link homebrew/versions/mongodb32
brew services start homebrew/versions/mongodb32