This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# add following line to end of your ~/.zshrc file and type "hoge" on command line | |
command_not_found_handler(){echo 44CAIOOAgOOAgOOAgCDjgIDjgIAg44CA77y/77y/77y/XwrjgIDjgIDjgIDjgIDjgIAg77yPIO+8vOOAgOOAgO+8j++8vOOAgO+9t+++mO+9rwog44CA44CA44CA44CA77yP44CA77yI44O877yJIOOAgO+8iOODvO+8ie+8vOOAgOOAgOOAgOOAgO+8nOOAjHt944CNCuOAgOOAgOOAgOOAgO+8j+OAgOOAgOKMkiDvvIhfX+S6ul9f77yJICDijJIgCuOAgOOAgOOAgOOAgHzjgIDjgIAg44CA44CA44CAfHLilKwtfOOAgOOAgOOAgHwK44CA44CA44CA44CAIO+8vOOAgOOAgOOAgOOAgCBg44O84oCZwrTjgIDjgIAg77yPCuOAgOOAgOOAgOOAgOODjuOAgOOAgOOAgOOAgOOAgOOAgOOAgOOAgOOAgOOAgO+8vArjgIAg77yPwrTjgIDjgIDjgIDjgIDjgIDjgIDjgIDjgIDjgIDjgIDjgIDjgIDjg70K44CAfOOAgOOAgOOAgOOAgO+9jOOAgOOAgOOAgOOAgOOAgOOAgOOAgOOAgOOAgOOAgO+8vArjgIDjg73jgIDjgIDjgIAgLeS4gOKAneKAneKAneKAnX5+772AYOKAmeOAgOOAgOOAgC3kuIDigJ3igJ3igJ3igJnjg7wt772kLgrjgIDjgIDjg70g77y/77y/77y/77y/KOKMkiko4oySKeKMkinjgIAp44CA44CAKOKMku+8vyjijJIp4oySKeKMkikpCgrjgIDjgIDjgIDjgIAg44CA44CA44CAIOOAgO+8v++8v++8v18K44CA44CA44CA44CA44CA44CA44CAIO+8j1/jg44g44CA44O9772kX++8vArjgIDvvpDjgIDvvpDjg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding:utf-8 | |
""" | |
usage: python adder-with-sed.py <max_num_digits> <max_num_terms> | |
$ echo '55+77-250+442' | sed -E -f <(python adder-with-sed.py 5 5) | |
=> 324 | |
""" | |
from collections import defaultdict | |
def sed_adjust_digits(digits): | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Throttle { | |
protected final int maxHistorySize = 10; | |
protected final double timeEpsilon = 1d/(1000 * 1000); | |
protected double maxThrottlePerSec = 1d; | |
protected LinkedList<Double> history = new LinkedList<>(); | |
public Throttle(double maxThrottle){ | |
this.maxThrottlePerSec = maxThrottle; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import yaml | |
import os | |
def _yaml_constructor_include(loader, node): | |
spl = node.value.split(' ') | |
if len(spl) == 1: | |
file = spl[0] | |
keys = None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
import sys | |
C = ['ヒツジ', '麦', 'レンガ', '木', '石'] | |
def katan(n): | |
import collections | |
c = collections.defaultdict(lambda: 0) | |
for i in range(n): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
def dataframe_to_wikitable(df): | |
lines = [] | |
columns = df.columns.values | |
lines.append('|| ' + ' || '.join(columns) + ' ||') | |
for ix, row in df.iterrows(): | |
line = '| ' + ' | '.join(str(row[col]) for col in columns) + ' |' | |
lines.append(line) | |
return '\n'.join(lines) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "container/heap" | |
type StringHeapSet struct { | |
heap stringHeapData | |
} | |
func (h *StringHeapSet) Push(v string) { | |
heap.Push(&h.heap, v) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import Collection, List, Dict | |
class Export: | |
""" | |
construct __all__ using decorator | |
Example: | |
>>> import os, sys | |
>>> from exporter import Export |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.function.Consumer; | |
import java.util.function.Function; | |
import java.util.function.Supplier; | |
final public class UnsafeLambdaUtil { | |
private UnsafeLambdaUtil(){} | |
public static class ExceptionWrapper extends RuntimeException { | |
private static final long serialVersionUID = 1L; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
"""sync_pipfile_versions.py | |
sync Pipfile dependency versions from Pipfile.lock | |
requires: | |
- Python >= 3.8 | |
- tomlkit | |
""" |