Skip to content

Instantly share code, notes, and snippets.

View potsbo's full-sized avatar
🕶️
Hack

Shimpei Otsubo potsbo

🕶️
Hack
View GitHub Profile
@potsbo
potsbo / doomsday.rb
Last active November 7, 2021 06:07
The Doomsday Algorithm
require 'date'
ANCHOR_DAYS = {
1800 => 5,
1900 => 3,
2000 => 2,
2100 => 0,
}
# supports only 1800 ~ 2199
@potsbo
potsbo / love-it-or-automate-it.rb
Last active October 10, 2018 08:50
Love It or Automate It
WHAT_I_LOVE = [
'automation',
'drinking',
'gaming',
'hacking',
'waching movies',
'talking with friends',
'programming',
]
@potsbo
potsbo / hanshin.py
Created January 12, 2018 09:19
1からnまでの自然数を全部足してその和がとある阪神数となるnは存在するか。
import math
from tqdm import tqdm
def sum_root_for(num):
num = num * 2
n = int(math.sqrt(num))
if n * (n + 1) == num:
return n
else:
#!/bin/bash
base_dir=`pwd`
git clone https://github.com/taku910/mecab.git
cd mecab/mecab
./configure --enable-utf8-only
make
make check
sudo make install
@potsbo
potsbo / dist.py
Created July 7, 2016 16:57
Distance between two points coordinated with longitude and latitude
# -*- coding: utf-8 -*-
# y: 中心 -> 北極
# x: 中心 -> (0,0)
# z: 中心 -> (0,90E)
import math
import numpy as np
def to_xyz(point):
p = map(math.radians, point)
@potsbo
potsbo / zorome.rb
Created May 5, 2016 12:48
n進数でゾロ目になる数を吐くプログラムを書きました
class Num
def initialize(num)
@num = num
end
def ary(base)
Ary.new({base: base, num: @num})
end
end
@potsbo
potsbo / instructions.md
Created January 7, 2016 11:13 — forked from tpai/instructions.md
use both Tor and Privoxy with Mac OSX

1. install

brew install tor
brew install privoxy

2. copy and modify config file

@potsbo
potsbo / cvimrc
Last active August 29, 2015 14:07
let hintcharacters = "aoeuidhtns"
map d scrollLeft
map h scrollDown
map t scrollUp
map n scrollRight
vmap d scrollLeft
vmap h scrollDown
vmap t scrollUp
vmap n scrollRight
map H previousTab