Skip to content

Instantly share code, notes, and snippets.

from typing import Protocol
class Ring(Protocol):
@staticmethod
def zero() -> "Ring":
...
@staticmethod
def identity() -> "Ring":
...
@kenoss
kenoss / hoge.md
Last active August 10, 2021 08:25
A poet on exception in python

元々の話題: python 初学者にオススメできる例外についての知見あれば

@kenoss
kenoss / README.md
Created February 7, 2020 13:23
How to pair bluetooth devices on linux
$ bluetoothctl
# scan on
...
[NEW] Device <...> HHKB-Hybrid_1
...
# scan off
# pair <...>
# connect <...>
# exit
@kenoss
kenoss / example_tasks.py
Created August 5, 2019 09:05
Python invoke: Add --exec option and make tasks dryable.
import invoke
import invoke_dryable as dryable
@invoke.task
@dryable.default_dryrun
def build(c, clean=False):
if clean:
print("Cleaning!")
@kenoss
kenoss / find-job.md
Created April 30, 2019 14:36
find-job.md

お仕事募集中です.

Last update: 2019-04-30

あなたは誰?

@kenoss
kenoss / readme.md
Created December 10, 2018 16:03
`pip install google-cloud-strage` failed

c.f.

pypa/setuptools#885 (comment)

error

$ pip install google-cloud-storage
Collecting google-cloud-storage
  Downloading https://files.pythonhosted.org/packages/d7/62/a2e3111bf4d1eb54fe86dec694418644e024eb059bf1e66ebdcf9f98ad70/google_cloud_storage-1.13.0-py2.py3-none-any.whl (59kB)
@kenoss
kenoss / client.rs
Last active May 5, 2018 17:34
Working example of unix domain socket in Rust (rustc 1.26.0-beta.18); c.f. http://www.cs.brandeis.edu/~cs146a/rust/rustbyexample-02-21-2015/sockets.html
// client.rs
use std::env;
use std::io::Write;
use std::os::unix::net::UnixStream;
use std::path::Path;
use common::SOCKET_PATH;
mod common;
function peco-find-file() {
local command
if git rev-parse 2> /dev/null; then
command='git ls-files'
else
command='find . -type f'
fi
local selected_files=$(eval $command | peco --prompt "[find file]")
LBUFFER="${LBUFFER% } $(echo ${selected_files} | tr '\n' ' ')"
function peco-find-file() {
local source_files
if git rev-parse 2> /dev/null; then
source_files=$(git ls-files)
else
source_files=$(find . -type f)
fi
local selected_files=$(echo $source_files | peco --prompt "[find file]")
LBUFFER="${LBUFFER% } $(echo ${selected_files} | tr '\n' ' ')"
@kenoss
kenoss / gist:365b6a12b3fe61164ebe
Created January 11, 2016 23:28
helm-occur for org headers
;;; helm in org
(defclass keu-helm-source-multi-occur-org-headers (helm-source-multi-occur)
((search :initform '(keu-helm-occur-org-headers-search))
; (search-strict :initform t)
(matchplugin :initform nil)))
;; Mimic of helm-occur. IT IS A MIMIC!
(defun keu-helm-occur-org-headers ()
"helm-occur for org headers."