Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python
'''
'''
import os
import sys
from sqlalchemy.engine.url import URL
from sqlalchemy import create_engine, text
import pandas as pd
import numpy as np
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@whym
whym / hr_replace_for_epub.py
Created October 21, 2017 08:40
Some epub readers ignore HR element in HTML. This program fixes it by replacing all HRs with '* * *'.
#! /usr/bin/env python
# -*- coding:utf-8 -*-
"""Some epub readers ignore HR element in HTML. This program fixes it by replacing all HRs with '* * *'. (Replacement is actually customizable beyond that)"""
import sys
import argparse
from ebooklib import epub
import re
import os
@whym
whym / iwenwiktnoll.py
Last active June 27, 2016 23:50
Add interwiki links to pages with no interwiki links
#! /usr/bin/env python2
# -*- coding: utf-8 -*-
import os
import sys
import oursql
import pandas as pd
sys.path.append(os.environ['PWB'])
from scripts import interwiki
@whym
whym / iwjawiktnoll.py
Last active May 30, 2016 11:07
Add interwiki links to pages in a given CSV list
#! /usr/bin/python3
import pandas as pd
import os
import sys
sys.path.append(os.environ['PWB'])
from scripts import interwiki
import pywikibot
def mygen(target):
package main
import (
"fmt"
"time"
"math/rand"
)
type Load struct {
val int
@whym
whym / bad_words.txt
Last active March 5, 2016 11:58
Japanese bad words list
死ね
しね
シネ
あほ
アホ
ばか
バカ
やりまん
ヤリマン
まんこ
@whym
whym / 政府ホームページ利用規約の一覧.mediawiki
Last active September 24, 2016 10:36
政府ホームページ利用規約と Creative Commons Attribution (CC BY)互換性明記の有無

以下の表の初版は2016年2月7日に政府(系)機関のCC BY対応状況を確認してまとめたものです。以後更新する可能性があります。「CC BY?」の欄は Creative Commons Attribution との互換性が規約に明記されているかどうかを示します。

政府機関 ウェブサイトの利用規約 CC BY?
内閣官房 http://www.cas.go.jp/jp/tyosakuken/contents.html
OK
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@whym
whym / bits.scala
Last active April 24, 2017 15:42
benchmark Java/Scala BigInt/BitSet implementations
// benchmark Java/Scala BigInt/BitSet implementations
import scala.util.Random
import scala.collection.mutable
import scala.collection.immutable
import java.util.BitSet
import java.math.BigInteger
// derived from https://github.com/alexmasselot/benchmark-bitarray/blob/master/src/benchmark/bitarray/TimeIt.scala
def timeInMilli(n: Int, f: () => Unit) = {