View ruhoh_compile.sh
#!/bin/zsh | |
cd $RUHOH | |
rm -r compiled | |
bundle exec ruhoh compile | |
cd - | |
echo -n "Copy the compiled result to your site repo?[y/n]" | |
read copy_yn | |
if [ "$copy_yn" = "y" ]; then | |
cd $PUBLISH | |
rm -r * |
View ec.sh
# 用ec来快速启动emacs client | |
alias sudo='sudo ' | |
alias ec='emacsclient -c -a ""' | |
# 现在可以将emacs设为默认编辑器啦 | |
export EDITOR='emacsclient -c -a ""' |
View ruhoh.sh
export RUHOH=/home/ehome/Documents/blog | |
export PUBLISH=/home/ehome/Documents/wzpan.github.io | |
alias _rp='cd $RUHOH && bundle exec rackup -p 9294' | |
alias _gd='cd $RUHOH && guard' | |
alias _dft='cd $RUHOH && bundle exec ruhoh posts draft' # 快速添加草稿 | |
alias _note='cd $RUHOH && bundle exec ruhoh wiki draft' # 快速添加笔记 | |
alias _tp='cd $RUHOH && bundle exec ruhoh posts titleize' # 快速为草稿文件命名 | |
alias _tn='cd $RUHOH && bundle exec ruhoh wiki titleize' # 快速为草稿文件命名 | |
alias _cp='ruhoh_compile' # 编译和交互式更新 |
View pandoc.rb
require "pandoc-ruby" | |
class Ruhoh | |
module Converter | |
module Markdown | |
def self.extensions | |
['.md', '.markdown'] |
View notifynet.sh
#!/bin/bash | |
net_stat=1 | |
while true | |
do | |
PINGRET=$( ping 8.8.8.8 -c 4 | grep "ttl=" ) | |
[ -z "$PINGRET" ] && | |
{ |
View fibonacci.py
class Fib: | |
def __init__(self, max): | |
self.max = max | |
def __iter__(self): | |
self.a = 0 | |
self.b = 1 | |
return self | |
def __next__(self): |
View plural.py
import re | |
class LazyRules: | |
rules_filename = 'rules.txt' | |
def __init__(self): | |
self.pattern_file = open(self.rules_filename, encoding='utf-8') | |
self.cache = [] | |
def __iter__(self): |
View romantest1.py
#!/bin/python3 | |
# A unit test example for convertion between roman number and digit number | |
import roman1 # the module you want to test | |
import unittest | |
class KnownValues(unittest.TestCase): | |
known_values = ((1, 'I'), | |
(2, 'II'), |
View file_io.py
#!/usr/bin/python | |
# Filename: file_io.py | |
poem = '''\ | |
Programming is fun | |
When the work is done | |
if you wanna make your work also fun: | |
use Python! | |
''' |
View videoGFW.js
/* Copyright (c) 2013 by Joseph Pan (http://hahack.com) */ | |
function videoGFW(src) { | |
if (window.XMLHttpRequest) | |
{// code for IE7+, Firefox, Chrome, Opera, Safari | |
var request = new XMLHttpRequest(); | |
} | |
else | |
{// code for IE6, IE5 | |
var request = new ActiveXObject("Microsoft.XMLHTTP"); |
OlderNewer