Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Kohei Yamada iberianpig

🏠
Working from home
View GitHub Profile
@iberianpig
iberianpig / WaylandUbuntu19.10-AppTitle
Created Jul 26, 2020 — forked from rbreaves/WaylandUbuntu19.10-AppTitle
Grab wmclass name or Window Name/Title under Wayland with Gnome 3.x
View WaylandUbuntu19.10-AppTitle
# Single Command, runs 2 calls to gdbus to get the currently active Window from Gnome 3.x
# Escaped so you can copy and paste into terminal directly
gdbus call -e -d org.gnome.Shell -o /org/gnome/Shell -m org.gnome.Shell.Eval global.get_window_actors\(\)[`gdbus call -e -d org.gnome.Shell -o /org/gnome/Shell -m org.gnome.Shell.Eval global.get_window_actors\(\).findIndex\(a\=\>a.meta_window.has_focus\(\)===true\) | cut -d"'" -f 2`].get_meta_window\(\).get_wm_class\(\) | cut -d'"' -f 2
# Unescaped version, will not run
# Broken down into 2 commands.
# Call to Gnome to get the array location of the active Application
gdbus call -e -d org.gnome.Shell -o /org/gnome/Shell -m \
@iberianpig
iberianpig / Makefile
Last active Jun 22, 2020
Update ath10k-firmware firmware for XPS 13 9360. git clone https://github.com/kvalo/ath10k-firmware and put Makefile in project root
View Makefile
.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
View Good-CONTRIBUTING.md-template.md

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 / qdbus_windows.sh
Created Feb 19, 2020
get running apps info
View qdbus_windows.sh
#!/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
@iberianpig
iberianpig / makef.sh
Last active Mar 15, 2019
`makef` override original ./Makefile with $MAKEF_PATH
View makef.sh
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 / mf2_free.rb
Last active Apr 10, 2021
MFの交通系ICカードリーダーで取得したCSVをFreeeで取り込める形式に変換する
View mf2_free.rb
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 / logind.conf
Created May 7, 2018
/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
View logind.conf
# 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 / genesis.json
Created Mar 9, 2018
genesis file for multiple nodes testing
View genesis.json
{
"config": {
"chainId": 15,
"homesteadBlock": 0,
"eip155Block": 0,
"eip158Block": 0
},
"nonce": "0x0000000000000042",
"timestamp": "0x0",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
@iberianpig
iberianpig / cahe_support.rb
Last active Oct 18, 2017
ActiveRecordProxyのメソッドチェーンでcache_keyを提供する
View cahe_support.rb
module CacheSupport
extend ActiveSupport::Concern
module ClassMethods
def cache_key
"#{name}/#{ids.hash}-#{maximum(:updated_at).to_i}"
end
end
end
@iberianpig
iberianpig / pre-commit
Created Aug 16, 2017
run lints for rails with pre-commit
View pre-commit
#!/usr/bin/env ruby
require "pry-byebug"
# execute pre-commit hooks
class PreCommitRunner
def run
check_eslint
check_rubocop
end