Skip to content

Instantly share code, notes, and snippets.

@lrtfm
lrtfm / beamer-notes-patch.tex
Last active May 13, 2024 10:03
A patch file for beamer with notes options [show notes] and [show notes on second screen] (for XeLaTeX)
% This is a patch for beamer with notes
% Usage:
% Input this file before set the option for notes, e.g.,
%
% \documentclass{beamer}
% \input{beamer-notes-patch}
% \setbeameroption{show notes on second screen=top}
%
% NOTE: This may still have warnings, e.g.,
% xdvipdfmx:warning: Object @linkA already defined.
@lrtfm
lrtfm / firedrake-run
Last active April 24, 2024 00:23
Run command in container of firedrake or firedrake-complex
#!/bin/bash
set -e
if [[ $# -eq 0 || x$1 =~ x-h|x--help ]]; then
PROG=$(basename $0)
echo ""
echo "Usage: $PROG command [args...]"
echo "Run command in docker container of firedrake."
echo ""
#!/bin/env python3
import os
import sys
if len(sys.argv) < 2:
print('Usage: sys.argv[0] <script>')
exit(0)
scripts = sys.argv[1]
@lrtfm
lrtfm / check-rsh-login.sh
Created March 3, 2018 12:50
检测哪些节点可以正常 rsh 登陆
bhosts | grep ok | cut -d" " -f1 | while read a; do if rsh $a test >/dev/null 2>&1; then echo $a; fi done
@lrtfm
lrtfm / .tmux.conf
Created October 10, 2014 18:38
tmux like vim
unbind C-b
set -g prefix C-a
setw -g mode-keys vi
# split window like vim
# vim's defination of a horizontal/vertical split is revised from tumx's
bind s split-window -h
bind v split-window -v
# move arount panes wiht hjkl, as one would in vim after C-w
bind h select-pane -L
@lrtfm
lrtfm / lisp
Last active August 29, 2015 14:07
tmux + vim + guile for lisp
alias cdnote='cd ~/repo/note-code/note'
alias lisp='if tmux ls 2>/dev/null | grep lisp >/dev/null 2>&1; then tmux a -t lisp ; else tmux new -s lisp \; splitw -l6 guile \; selectp -t 0; fi'
alias note='if tmux ls 2>/dev/null | grep note >/dev/null 2>&1; then tmux a -t note ; else tmux new -s note\; splitw -v -l6 \; selectp -t 0; fi'
<p id="chiristmas" style="font-size: xx-large;">&nbsp;</p>
<script type="text/javascript">// <![CDATA[
var now =new Date();
var new_year = new Date("Dec 25, 2012 0:0:0");
var num_of_yoi = 1+( new_year.getTime() - now.getTime())/ 86400000;
field= document.getElementById('chiristmas');
var yois = "";
@lrtfm
lrtfm / tags.html
Created May 15, 2012 16:36
jekyll tag index
---
layout: def
title: TAGS
---
<div id="tagindex">
{% capture array %}{% for tag in site.tags %}{{ tag | first }}
{% endfor %}{% endcapture %}
{% for tag in array %}
<div id={{tag}} >
@lrtfm
lrtfm / linenumber.js
Created May 11, 2012 16:22
Add line number for text in element "<pre><code>".
//add line num for the code in Elenment "<pre><code>"
function addLineNum()
{
try {
var mycode = document.getElementsByTagName("code");
var space = /^[ \t\b]*$/;
//var times = mycode.length;
for (var loop = 0; loop < mycode.length; ) {
var s = mycode[loop];
var p = s.parentNode;