This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
# itex2mml.php | |
# A MediaWiki extension which adds support for itex2mml. | |
if (!defined('MEDIAWIKI')) die(); | |
$wgExtensionCredits['other'][] = array( | |
'name' => 'itex2mml', | |
'description' => 'Adds support for math via itex2mml.', | |
'version' => '0.1' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% arrows | |
\newcommand{\too}{\longrightarrow} | |
\newcommand{\isoto}{\stackrel{\sim}{\longrightarrow}} | |
\newcommand{\hook}{\hookrightarrow} | |
\newcommand*{\longhookrightarrow}{\ensuremath{\lhook\joinrel\relbar\joinrel\rightarrow}} | |
\newcommand{\hooklong}{\longhookrightarrow} | |
\newcommand{\sub}{\subset} | |
% operators | |
\DeclareMathOperator*{\fibprod}{\times} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Save the following as a bookmark: | |
// javascript:(function()%7Bfunction%20callback()%7B(function(%24)%7Bvar%20jQuery%3D%24%3Bvar%20str%20%3D%20%22%2B--%20%7B%3A%20.un_defn%7D%5Cn%5C%23%23%23%23%23%23%20Definition%5Cn%5Cn%5C%3D--%5Cn%22%3Bvar%20caretPos%20%3D%20document.getElementById(%22content%22).selectionStart%3Bvar%20textareaVal%20%3D%20%24(%22%23content%22).val()%3B%24(%22%23content%22).val(textareaVal.substring(0%2C%20caretPos)%20%2B%20str%20%2B%20textareaVal.substring(caretPos))%7D)(jQuery.noConflict(true))%7Dvar%20s%3Ddocument.createElement(%22script%22)%3Bs.src%3D%22https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fjquery%2F1.7.1%2Fjquery.min.js%22%3Bif(s.addEventListener)%7Bs.addEventListener(%22load%22%2Ccallback%2Cfalse)%7Delse%20if(s.readyState)%7Bs.onreadystatechange%3Dcallback%7Ddocument.body.appendChild(s)%3B%7D)() | |
function runInstikiDefnBookmarklet() { | |
var str = "+-- {: .un_defn}\n\ | |
###### Definition\n\n\ | |
=--\n"; | |
var caretPos = document.getElementById("content").selectionStart; | |
var |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import berry | |
from berry import path, render, redirect | |
from models import Post | |
def index(): | |
posts = Post.query.all() | |
return render('index', {'posts': posts}) | |
path('^$').GET = index | |
def post(id): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# test.py | |
@cmd('^$') | |
def index(): | |
# this is what shows up when you run python test.py | |
return "Welcome to test.py..." | |
@get('^hello (.+)$') | |
def hello(name): | |
# this shows up when you run python test.py hello <name> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import smtplib | |
from smtplib import SMTPException | |
from email.mime.text import MIMEText | |
config = { | |
'host': None, | |
'port': None, | |
'username': None, | |
'password': None, | |
'use_tls': False, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://74.125.95.132/search?q=cache:81MAwvRRt4kJ:twitter.com/_why/status/3389695893 | |
programming is rather thankless. you see your works become replaced by superior works in a year. unable to run at all in a few more. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# How to get the password hint for lib.homelinux.org | |
import httplib | |
conn = httplib.HTTPConnection("lib.homelinux.org") | |
conn.request("HEAD", "/") | |
print conn.getresponse().getheaders()[3][1].decode("cp1251") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def _recursive_dict_update(x, y): | |
for key, val in y.iteritems(): | |
if isinstance(val, dict): | |
if not x.has_key(key): | |
x[key] = {} | |
x[key] = _recursive_dict_update(x[key], val) | |
elif isinstance(val, list): | |
if not x.has_key(key): | |
x[key] = [] | |
x[key].extend(val) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
FILE1=$1 | |
FILE2=$2 | |
# http://www.gnu.org/software/wdiff/ | |
wdiff -w "<span style='color:red; text-decoration: line-through;'>" \ | |
-x "</span>" \ | |
-y "<span style='color:green'>" \ | |
-z "</span>" \ |
OlderNewer