Skip to content

Instantly share code, notes, and snippets.

View iberianpig's full-sized avatar

Kohei Yamada iberianpig

View GitHub Profile
@iberianpig
iberianpig / sentakushi.rb
Last active February 2, 2017 11:39
文字列を与えると一様な組み合わせを返す
['a', 'b', 'c', 'd'].permutation.to_a[Digest::MD5.hexdigest("hogefuga").to_i(16) % 24]
#=> ["a", "b", "d", "c"]
@iberianpig
iberianpig / pre-commit
Created August 16, 2017 08:44
run lints for rails with pre-commit
#!/usr/bin/env ruby
require "pry-byebug"
# execute pre-commit hooks
class PreCommitRunner
def run
check_eslint
check_rubocop
end
@iberianpig
iberianpig / cahe_support.rb
Last active October 18, 2017 07:33
ActiveRecordProxyのメソッドチェーンでcache_keyを提供する
module CacheSupport
extend ActiveSupport::Concern
module ClassMethods
def cache_key
"#{name}/#{ids.hash}-#{maximum(:updated_at).to_i}"
end
end
end
@iberianpig
iberianpig / genesis.json
Created March 9, 2018 03:44
genesis file for multiple nodes testing
{
"config": {
"chainId": 15,
"homesteadBlock": 0,
"eip155Block": 0,
"eip158Block": 0
},
"nonce": "0x0000000000000042",
"timestamp": "0x0",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
@iberianpig
iberianpig / logind.conf
Created May 7, 2018 05:38
/etc/systemd/logind.conf for hibernate XPS-13-9360 4.10.0-35-generic #39~16.04.1-Ubuntu SMP Wed Sep 13 09:02:42 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
#
# Entries in this file show the compile time defaults.
# You can change settings by editing this file.
# Defaults can be restored by simply deleting this file.
@iberianpig
iberianpig / mf2_free.rb
Last active April 10, 2021 13:37
MFの交通系ICカードリーダーで取得したCSVをFreeeで取り込める形式に変換する
require 'csv'
class Mf2Freee
FILE_NAME = "収入・支出詳細_2020"
def run
files = Dir.glob("./#{FILE_NAME}*.csv")
file = files.first
raise 'file not found' if file.nil?
## mf ##
@iberianpig
iberianpig / makef.sh
Last active March 15, 2019 07:22
`makef` override original ./Makefile with $MAKEF_PATH
function makef() {
make -f "$(makef_path)" "$@"
}
_makef()
{
COMPREPLY=( $(compgen -W "$(grep -oE '^[a-zA-Z0-9_-]+:([^=]|$)' "$(makef_path)" | sed 's/[^a-zA-Z0-9_.-]*$//')" $2) )
}
complete -F _makef makef
@iberianpig
iberianpig / qdbus_windows.sh
Created February 19, 2020 16:37
get running apps info
#!/bin/bash
get_window_paths()
{
qdbus org.ayatana.bamf /org/ayatana/bamf/matcher org.ayatana.bamf.matcher.WindowPaths
}
get_running_apps()
{
qdbus org.ayatana.bamf /org/ayatana/bamf/matcher org.ayatana.bamf.matcher.RunningApplications

Contributing

When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.

Please note we have a code of conduct, please follow it in all your interactions with the project.

Pull Request Process

  1. Ensure any install or build dependencies are removed before the end of the layer when doing a
@iberianpig
iberianpig / Makefile
Last active June 22, 2020 09:59
Update ath10k-firmware firmware for XPS 13 9360. git clone https://github.com/kvalo/ath10k-firmware and put Makefile in project root
.PHONY: all
TODAY := $(shell date --rfc-3339 date)
all: help
backup_QCA6174: ## backup
mkdir -p backup/$(TODAY)/
cp -a /lib/firmware/ath10k/QCA6174 backup/$(TODAY)/QCA6174