Skip to content

Instantly share code, notes, and snippets.

View hamukichi's full-sized avatar

Hamukichi (Nombiri) hamukichi

View GitHub Profile
@hamukichi
hamukichi / IronPythonDetector.py
Last active August 29, 2015 13:56
IronPythonがインストールされているディレクトリのパスを、CPythonなどから取得するためのPythonスクリプト。http://blog.livedoor.jp/hamu_nbr/archives/36565637.html に掲載。
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
IronPython Detector
===================
Detect the directory (or directories) where the IronPython executable(s) exist(s).
"""
@hamukichi
hamukichi / pythontex_ex01.tex
Created August 10, 2014 13:58
PythonTeXの動作を確認するために、簡単な文書を書いた。
\documentclass[a4j]{jsarticle}
% Unicode文字を使用できるようにする
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
% 数式の記述に用いる
\usepackage{amsmath}
% PythonTeXを利用する
@hamukichi
hamukichi / pythontex_graph.tex
Created February 16, 2015 12:05
PythonTeXを用いて、図の作成と文書への埋め込みを一度に行う例。とりあえず動作を確認した程度。
\documentclass[a4j]{jsarticle}
% Unicode文字を使用できるようにする
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
% 数式の記述に用いる
\usepackage{amsmath}
% 図の埋め込みに用いる
@hamukichi
hamukichi / index.html
Created March 10, 2015 13:30
Brythonを用いて作成した、簡単なおみくじ。
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>おみくじ</title>
<meta charset="utf-8">
<meta name="description" content="ごく単純なおみくじ。Brythonのテストとして。">
<meta name="author" content="はむ吉(のんびり)">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="style.css">
@hamukichi
hamukichi / pyken2ch.py
Created December 27, 2013 11:38
2ちゃんねるのken.cgiをPythonで利用する。http://blog.livedoor.jp/hamu_nbr/archives/32035188.html に掲載。
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Convert hostname (or IP address) into the name of prefecture.
"""
__author__ = "Hamukichi (Nombiri) <Twitter: @hamukichi_nbr>"
__version__ = "1.00"
__date__ = "September 13, 2013"
@hamukichi
hamukichi / gather_ipy_dll.py
Created December 27, 2013 11:53
IronPythonのpyc.pyでスクリプトをEXE化する際に、"No module named ..." エラーが出るという問題に対処するために、標準モジュールをすべて1つのDLLにまとめるスクリプト。おそらくもっとスマートな方法があるだろうと思う。http://blog.livedoor.jp/hamu_nbr/archives/20556672.html に掲載。
#!D:/IronPython/ipy.exe
# -*- coding: utf-8 -*-
#D:\Source\gather_ipy_dll.py
#ipy.exeが存在するディレクトリ
IPYROOT = ur"D:\IronPython"
#出力するディレクトリ・ファイル名
import os
@hamukichi
hamukichi / pyimkayac.py
Created December 27, 2013 12:03
im.kayac.com を利用するためのPythonモジュール。http://blog.livedoor.jp/hamu_nbr/archives/32644041.html に掲載。
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Send notification using im.kayac.com
"""
__author__ = "Hamukichi (Nombiri) <Twitter: @hamukichi_nbr>"
__version__ = "1.00"
__date__ = "September 30, 2013"
@hamukichi
hamukichi / gcj_qr2016c.py
Created April 10, 2016 07:12
Google Code Jam Qualification Round 2016 C. Coin Jamに対するSymPyによる解答例。
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Google Code Jam 2016 Qualification Round
# Problem C. Coin Jam
# Modules from the Python standard library.
import collections
import functools
@hamukichi
hamukichi / yukicoder0416.cpp
Created August 29, 2016 02:51
yukicoder No.416 旅行会社 に対するC++による解答コード。
#include <algorithm>
#include <ciso646>
#include <cstdlib>
#include <iostream>
#include <numeric>
#include <set>
#include <vector>
#include <unordered_set>
#include <utility>
@hamukichi
hamukichi / cpr.py
Last active October 2, 2016 07:44
APIを利用して、CodeforcesとTopCoder SRMにおける自分のRating変化を取得するPythonスクリプト。例外処理等が不十分なので注意。ライブラリとしてRequestsが必要。
#!/usr/bin/env python3
import collections
import requests
CF_ENTRYPOINT = "http://codeforces.com/api/user.rating"
TC_ENTRYPOINT = "http://api.topcoder.com/v2/users/{}/statistics/data/srm"
RatingInfo = collections.namedtuple("RatingInfo", "old new delta")