Skip to content

Instantly share code, notes, and snippets.

@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
PS1=\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n\$
@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 / gfm.rb
Created May 13, 2012 05:47 — forked from mojombo/gfm.rb
require 'digest/md5'
def gfm(text)
# Extract pre blocks
extractions = {}
text.gsub!(%r{<pre>.*?</pre>}m) do |match|
md5 = Digest::MD5.hexdigest(match)
extractions[md5] = match
"{gfm-extraction-#{md5}}"
end
@lrtfm
lrtfm / gfm.rb
Created May 13, 2012 05:47 — forked from mojombo/gfm.rb
require 'digest/md5'
def gfm(text)
# Extract pre blocks
extractions = {}
text.gsub!(%r{<pre>.*?</pre>}m) do |match|
md5 = Digest::MD5.hexdigest(match)
extractions[md5] = match
"{gfm-extraction-#{md5}}"
end