Skip to content

Instantly share code, notes, and snippets.

Avatar

Ryohei Seto ryseto

View GitHub Profile
@ryseto
ryseto / Covid19-slope.nb
Last active Jul 22, 2021
Covid19 slope
View Covid19-slope.nb
worlddata =
Import["https://covid.ourworldindata.org/data/owid-covid-data.csv"];
font = "Helvetica Neue";
slopeangle = Pi/6;
pos0 = {0, 0};
radius = Log[10]/Pi;
slopepos[val_, h_] :=
pos0 + {Cos[slopeangle]*val +
h*Sin[slopeangle], (-Sin[slopeangle])*val + h*Cos[slopeangle]}
@ryseto
ryseto / latexdiff_dropbox.sh
Last active Aug 29, 2015
latexdiff_dropbox.sh
View latexdiff_dropbox.sh
#!/bin/sh
my_typesetter="latexmk"
my_latexdiff="latexdiff"
orig_file=`basename $1 .tex`
if [ ! -f $orig_file.tex ]; then
echo "PDF file is not found."
exit
fi
echo "Input the version:"
View emacs_pdftexsync.sh
#!/bin/bash
#
# You need to put the following in ~/.emacs.d/init.el.
# (if window-system
# (progn
# (require 'server)
# (unless (server-running-p) (server-start))))
#
EMACS_PID_ALL=`pgrep -d ' ' Emacs`
EMACS_ACTIVE=0
@ryseto
ryseto / jor_template.tex
Created Jun 11, 2014
Templete for Journal of Rheology
View jor_template.tex
\documentclass[
aip,
author-year,
reprint,
onecolumn,
tightenlines,
12pt,
notitlepage,
amsmath,
amssymb
View word-pronunciation.el
(defun MyTool-speech-word()
"Speak words."
(interactive)
(let* ((str (url-hexify-string (string-word-or-region))))
(process-kill-without-query
(start-process-shell-command "speech" nil
"/usr/bin/say -r 150" (concat "\"" str "\"" )))))
(defun string-word-or-region ()
"If a region is selected, the text string of the region is returned.
View .gnuplot
set terminal qt
tg_L=0
bind "L" "tg_L=tg_L+1;if(tg_L%2)set logs;replot; else unset logs;replot;"
tg_k=1
bind "k" "tg_k=tg_k+1;if(tg_k%2)set key;replot; else unset key;replot;"
tg_l=0
bind "-" "tg_l=tg_l+1;if(tg_l%2)set style data lp;replot; else set style data p;replot;"
bind "O" "set term post eps color enhanced 18;set out 'tmp_gnuplot.eps';replot;set term qt;
bind "P" "! open -a Preview tmp_gnuplot.eps;"
@ryseto
ryseto / st_visual.py
Last active Jan 4, 2016
visualization of 2d sheared particles by using vpython
View st_visual.py
#/Applications/VPython-Py2.7/VIDLE.app/Contents/MacOS/Python
# coding=utf-8
from visual import *
import numpy
import sys
fin = open(sys.argv[1])
scene = display(title='Simple Shear',
width=1100, height=800,
@ryseto
ryseto / gist:7955308
Last active Dec 31, 2015
Open the bibitem in BibDesk.app
View gist:7955308
(defun MyTeX-open-item-BibDesk ()
"Open the bibitem in BibDesk.app"
(interactive)
(let* ((s (save-excursion
(skip-chars-backward "^{,")
(point)))
(e (save-excursion
(skip-chars-forward "^},")
(point))))
(browse-url (concat "x-bdsk://" (buffer-substring-no-properties s e)))))
@ryseto
ryseto / skim-forward-search.el
Last active Nov 12, 2018
Emacs から Skim.app で開いている PDF の編集位置を表示させる関数(YaTeX 1.78 以降は標準のジャンプ機能で対応している)
View skim-forward-search.el
;;; Tsuchiya-san's corrections (yatex ML [yatex:04810,04811])
(defun skim-forward-search ()
(interactive)
(process-query-on-exit-flag
(start-process
"displayline"
nil
"/Applications/Skim.app/Contents/SharedSupport/displayline"
(number-to-string (save-restriction
(widen)
@ryseto
ryseto / gist:4589945
Last active Dec 11, 2015
Emacs で編集中のファイルが入っているフォルダ(ディレクトリ)を Finder/Terminal で開く。 ショートカットは ⌘-Shift-Option-F と ⌘-Shift-Option-T。
View gist:4589945
;;; Finder でフォルダを開く
;; ショートカット: ⌘-option-shift-F
;; (ショートカットは USキーボードで確認)
(define-key global-map [?\s-Ï] 'MyTool-open-folder-in-finder)
(defun MyTool-open-folder-in-finder ()
"open -a Finder.app CURRENT-DIRECTORY"
(interactive)
(process-query-on-exit-flag
(start-process-shell-command "open folder in Finder" nil "open .")))