Skip to content

Instantly share code, notes, and snippets.

View hlian's full-sized avatar
🦫
beaver

Hao Lian hlian

🦫
beaver
View GitHub Profile
/*
* The fonts and font delivery service used on this website are provided via
* Typekit, and are subject to the End User License Agreement entered into by
* the website owner. All other parties are explicitly restricted from using,
* in any manner, the Services, Licensed Fonts, or Licensed Content. Details
* about using Typekit, the EULA, and information about the fonts are listed
* below.
*
* @allow www.usual.ee
* @allow usual.ee
$ java Test
Exception in thread "main" java.lang.RuntimeException: ooh
at Test.main(Test.java:3)
@hlian
hlian / gist:488860
Created July 24, 2010 17:58
Google Code Jam: Practice Mode: Alien Numbers
#!/usr/bin/env python
"""
Google Code Jam: Practice Mode: Alien Numbers.
http://code.google.com/codejam/contest/dashboard?c=32003
"""
import os
import sys
@hlian
hlian / oauth.rb
Created September 3, 2010 22:55 — forked from twoism/oauth.rb
#!/usr/bin/env ruby
%w{rubygems hmac-sha1 base64 cgi net/https uri openssl}.each{ |f| require f }
KEY = '<YOUR KEY>';
SECRET = '<YOUR SECRET>';
# encodes strings that make twitter oauth happy
def encode( string )
URI.escape( string, Regexp.new("[^#{URI::PATTERN::UNRESERVED}]") ).gsub('*', '%2A')
end
<mt:setvarblock name="i"><$mt:FullEntryCount$></mt:setvarblock>
<MTEntries lastn="$i">
<mt:ignore><!-- Use the Entry Summary module for each entry published on this page --></mt:ignore>
<$mt:include module="Entry Summary"$>
</MTEntries>
<h1 class="archive-title">Also...</h1>
<div class="entry-listing">
<ul>
<mt:setvarblock name="j"><$mt:EntryTitleCount$></mt:setvarblock>
<mt:Pages folder="home">
<div id="page-<$mt:PageID$>" class="page-asset asset">
<div class="asset-header">
<h1 id="page-title" class="asset-name"><$mt:PageTitle$></h1>
</div>
<div class="asset-content">
<mt:If tag="PageBody">
<div class="asset-body">
<$mt:PageBody$>
</div>
#include <stdlib.h>
#include <stdio.h>
int main(int argc, char **argv) {
printf("%s\n", argv[1]);
return 0;
}
alert("hello!");
(defun tex-view ()
"Preview the last `.dvi' file made by running TeX under Emacs.
This means, made using \\[tex-region], \\[tex-buffer] or \\[tex-file].
The variable `tex-dvi-view-command' specifies the shell command for preview.
You must set that variable yourself before using this command,
because there is no standard value that would generally work."
(interactive)
(or tex-dvi-view-command
(error "You must set `tex-dvi-view-command'"))
;; Restart the TeX shell if necessary.
\documentclass[oneside, article, twocolumn]{memoir}
\usepackage{amsmath, microtype}
\usepackage[margin=0.5in]{geometry}
\usepackage[charter]{mathdesign}
% Line spacing.
\linespread{1.1}
% Vector norm notation.
\newcommand{\vectornorm}[1]{\left|\left|#1\right|\right|}
% arg max operator.