Skip to content

Instantly share code, notes, and snippets.

View umhan35's full-sized avatar

Zhao Han umhan35

View GitHub Profile
#include <stdio.h>
int main() {
printf("%s\n", (char[]) {0b01101001, 0b00100000, 0b01101100, 0b01101111, 0b01110110, 0b01100101, 0b00100000, 0b01111001, 0b01101111, 0b01110101, '\0'});
}
@umhan35
umhan35 / 0.m
Last active July 14, 2016 03:10
access asyncLocalStorage in objective-c
// add libReact.a
// import
#import "RCTAsyncLocalStorage.h"
// code
RCTAsyncLocalStorage *asyncLocalStorage = [[RCTAsyncLocalStorage alloc] init];
dispatch_async([asyncLocalStorage methodQueue], ^{
[asyncLocalStorage multiGetKeys:@[@"widget_city"] callback:^(NSArray *response){
@umhan35
umhan35 / Debug scala code using jdb.md
Last active April 10, 2016 16:25
Debug scala code using jdb
@umhan35
umhan35 / print classpath from sbt.md
Last active April 10, 2016 16:25
print classpath from sbt

add the following to build.sbt

TaskKey[String]("cp") <<= (externalDependencyClasspath in Runtime) map (_.files.absString)

run show cp in sbt

@umhan35
umhan35 / server.scala
Last active March 26, 2016 03:41
Simplest scala http server
import com.sun.net.httpserver._
import java.net._
val server = HttpServer.create(new InetSocketAddress(8000), 0)
server.createContext("/", new HttpHandler {
def handle(exchange: HttpExchange) {
exchange.sendResponseHeaders(200, 0)
exchange.getResponseBody.write("hello".getBytes)
exchange.getResponseBody.close()
@umhan35
umhan35 / .latexmkrc
Created March 16, 2016 01:51
use skim with latexmk
$pdf_previewer = "open -a Skim"
@umhan35
umhan35 / body.default.tex
Created June 11, 2015 01:32
body.default.tex
\begin{abstract}
\end{abstract}
\section{Introduction}
\section{Background}
\section{Related Work}
@umhan35
umhan35 / latex-CJK.tex
Last active August 29, 2015 14:20
Latex Chinese/Japanese/Korean support
\usepackage{CJKutf8}
\begin{CJK}{UTF8}{gbsn}
% gbsn (简体宋体, simplified Chinese)
%gkai (简体楷体, simplified Chinese )
% source: http://latex-my.blogspot.ca/2010/06/cjk-support-in-latex.html
addnginxuser() {
# creating nginx group if he isn't already there
if ! getent group nginx >/dev/null; then
addgroup --system nginx >/dev/null
fi
# creating nginx user if he isn't already there
if ! getent passwd nginx >/dev/null; then
adduser \
--system \
@umhan35
umhan35 / update conda and anaconda.txt
Last active April 10, 2016 16:27
update conda and anaconda
conda update conda
conda update anaconda