Skip to content

Instantly share code, notes, and snippets.

View uchida's full-sized avatar

Akihiro Uchida uchida

View GitHub Profile
@uchida
uchida / arxiv2bib.py
Last active March 22, 2024 11:19
a simple BibTeX file generator from arxiv.org URL
#!/usr/bin/python
# -*- coding: utf-8 -*-
# CC0, dedicated to public domain by Akihiro Uchida
import argparse
import urllib2, os
from HTMLParser import HTMLParser
import re
import calendar
ARXIV_ID_RE = re.compile(r'arXiv:((\d\d)(\d\d)\.\d+)')
#!/bin/sh
docker ps -q -f status=exited | xargs --no-run-if-empty docker rm
docker images -q -f dangling=true | xargs --no-run-if-empty docker rmi
@uchida
uchida / enumerate.cs
Created November 28, 2011 13:55
C# sample code for equivalent of python enumerate()
// GWLlosa's answer in http://stackoverflow.com/questions/521687/c-sharp-foreach-with-index
using System;
using System.Collections.Generic;
using System.Linq;
namespace EnumerateTest {
class Program {
static void Main(string[] args) {
List<int> list = new List<int> {4, 2, 3, 1, 8};
@uchida
uchida / gist:1759935
Last active November 12, 2022 06:09
latexmkrc sample for LaTeX documents with pdflatex
# -*- cperl -*-
# latexmkrc
$pdflatex = 'pdflatex -8bit -etex -halt-on-error -synctex=1 %O %S';
$pdf_mode = 1;
$bibtex_use = 1;
$clean_ext = '%R_flymake.aux %R_flymake.dvi %R_flymake.log %R_flymake.out';
$clean_full_ext = 'bbl synctex.gz';
@uchida
uchida / rand.cpp
Created September 14, 2012 05:31
boost random distribution usage sample
#include <iostream>
#include <boost/function.hpp>
#include <boost/bind.hpp>
#include <boost/random/mersenne_twister.hpp>
#include <boost/random/uniform_real_distribution.hpp>
#include <boost/random/normal_distribution.hpp>
int main(int argc, char* argv[])
{
size_t seed = 1234567890;
@uchida
uchida / Tweaks.rst
Last active January 1, 2021 04:35
Sphinx と LaTeX を使うときの 小技

Sphinx と LaTeX を使うときの 小技

著者

打田 旭宏

ライセンス

CC-BY 3.0

更新日時

Sphinx の LaTeX 出力を利用するときに見栄えを凝るのに知っておくとよいかもしれない小技をまとめました。

@uchida
uchida / CC0_CLA.md
Last active January 5, 2019 20:19
CLA for CC0

Copyright Statement for Contributions

I hereby represent that all present, past and future contributions are governed by the Creative Commons Zero 1.0 Universal copyright statement, placing my contributions in the publicdomain. This entails that to the extent possible under law I waive all copyright and related or neighboring rights to the code or documents I contribute. I also represent that I have the authority to perform the above waiver with respect to the entirety of my contributions.

@uchida
uchida / uninstall_mactex.sh
Last active March 1, 2018 16:08
MacTeX uninstaller script based on pkgutil command
#!/bin/bash
# MacTeX uninstaller script based on pkgutil command
# by Akihiro Uchida, CC0 dedicated to the public domain
# see http://creativecommons.org/publicdomain/zero/1.0/
IFS=$(echo -en "\n")
for pkg in $(pkgutil --pkgs|grep org.tug.mactex); do
volume="$(pkgutil --pkg-info "$pkg"|grep volume|cut -d' ' -f2-)"
location="$(pkgutil --pkg-info "$pkg"|grep location|cut -d' ' -f2-)"
echo "remove all of the files installed under the $pkg"
for file in $(pkgutil --files "$pkg"); do
@uchida
uchida / texmacro.rst
Created November 3, 2012 03:04
Sphinx + MathJax で自作 TeX マクロを使う

Sphinx + MathJax で自作 TeX マクロを利用する

sphinx の mathjax 拡張に手を加えて簡単な TeX マクロを使えるようにしてみました。

使い方

  1. 改造した mathjax.py を conf.py のある場所に置く
@uchida
uchida / dlclt.py
Created August 31, 2012 22:22
CUI Downloader of Command Line Tools for Xcode
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# CUI Downloader of "Command Line Tools for Xcode"
# by Akihiro Uchida, CC0 dedicated to the public domain
# see http://creativecommons.org/publicdomain/zero/1.0/
import sys, os
import urllib, urllib2, cookielib
from getpass import getpass
from HTMLParser import HTMLParser