Skip to content

Instantly share code, notes, and snippets.

View astronasutarou's full-sized avatar

Ryou Ohsawa astronasutarou

View GitHub Profile
@astronasutarou
astronasutarou / croppdf.sh
Created April 23, 2024 05:33
A bash script to crop out the margins of the PDF file.
#!/bin/bash
INPUT=${1:?}
OUTPUT=${2:-${INPUT//.pdf/-crop.pdf}}
get_bbox() {
gs -sDEVICE=bbox \
-dBATCH -dNOPAUSE \
-c save pop \
-f ${INPUT} 2>&1 \
| grep 'HiResBoundingBox' \
@astronasutarou
astronasutarou / post.arXiv.org.to.scrapbox.user.js
Created May 18, 2021 17:17
Greasemonky script to post an arXiv entry to your Scrapbox.io
// ==UserScript==
// @name post new paper to Scrapbox
// @description post arXiv.or.js to your Scrapbox.io
// @namespace http://xr0038.net
// @include https://arxiv.org/abs/*
// @run-at document-end
// @version 1
// ==/UserScript==
(function(Scrapbox){
@astronasutarou
astronasutarou / Universal.gpl
Created March 18, 2019 00:25
色覚の多様性に配慮した案内・サイン・図表等用のカラーユニバーサルデザイン推奨配色を inkscape 等で使用するためのパレット (cf. http://jfly.iam.u-tokyo.ac.jp/colorset/)
GIMP Palette
Name: Color Universal Design
Columns: 1
#
255 75 0 J08-50V
255 241 0 J27-85V
3 175 122 J46-60T
0 90 255 J72-40T
77 196 255 J69-70P
255 128 130 J02-70T
@astronasutarou
astronasutarou / JISSafeColor.gpl
Last active March 18, 2019 00:23
JIS 安全色 (JIS Z 9103) の色を inkscape 等で使うためのパレット (cf. http://safetycolor.jp/shiteichi/)
GIMP Palette
Name: JIS Safe Color
Columns: 1
#
255 75 0 J08-50V
246 170 0 K15-65X
242 231 0 K27-80V
0 176 107 K45-55T
25 113 255 K72-45T
153 0 153 K89-40T
@astronasutarou
astronasutarou / MyDefinition.tex
Last active January 17, 2019 14:04
初回とそれ以降で評価される内容が異なるコマンドをつくる
\documentclass[a4paper]{jsarticle}
\usepackage{xspace}
\usepackage{etoolbox,etextools}
\makeatletter
\newcommand*{\MyDefinition}[3]{%
\newtoggle{\string#1}%
\togglefalse{\string#1}%
\DeclareRobustCommand*#1{%
\@ifstar{\csname s\string#1\endcsname}{\csname n\string#1\endcsname}}%
@astronasutarou
astronasutarou / gp.py
Last active January 7, 2019 13:40
Gaussian Process Sample in the Stan User's Guide
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function, absolute_import, division
from kernel import expand_dims
import numpy as np
import scipy as sci
def GPmodel(x, y, kernel, **options):
x,y = expand_dims(x),expand_dims(y)
@astronasutarou
astronasutarou / request_mpc.py
Created March 19, 2018 07:39
throw a request to MPChecker
#!/usr/bin/env python
#-*- coding: utf-8 -*-
from argparse import ArgumentParser as ap
from astropy.time import Time
from astropy.coordinates import Longitude, Latitude
from pprint import pprint
from pyquery import PyQuery
import astropy.units as u
import requests, sys
@astronasutarou
astronasutarou / image2_to_avi_by_ffmpeg.sh
Created February 20, 2018 07:05
アスペクト比が 4:3 の画像リストから 16:9 の動画を作成するためのコマンドメモ
ffmpeg -r 6 -f image2 -start_number 1000 -i image%4d.jpg \
-vf 'scale=1280:720:force_original_aspect_ratio=decrease,pad=1280:720:160:0' \
-vcodec h264 -pix_fmt yuv420p -r 6 output.avi
@astronasutarou
astronasutarou / file0.txt
Last active December 29, 2017 06:52
gnuplot でポン・デ・リング ref: https://qiita.com/xr0038/items/ddbecc69902888b4fa4a
splot Z(x,y) t "Z は座標 (x,y) での z 座標を返す関数"
@astronasutarou
astronasutarou / abstract.tex
Last active December 4, 2017 08:24
IDP 2018 http://www.perc.it-chiba.ac.jp/meetings/IDP2018 のアブストラクト用の LaTeX スタイルファイル試作
\documentclass[10pt,a4paper,pdftex]{article}
\usepackage{idp2018}
\title{Template and Instructions for Abstract Submission to IDP 2018}
\author{A. B. Author$^1$}
\affil{$^1$Affiliation for A. B. Author}
\email{author.a.b@example.com}
\begin{document}
\section{Introduction}