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 / one way binding...?.html
Last active April 10, 2016 16:28
one way binding...?
<input type="number">
<p></p>
<script type="text/javascript">
var p = document.querySelector('p')
var i = document.querySelector('input')
i.oninput = function () {
p.textContent = this.value
}
</script>
@umhan35
umhan35 / update conda and anaconda.txt
Last active April 10, 2016 16:27
update conda and anaconda
conda update conda
conda update anaconda
@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 / Debug scala code using jdb.md
Last active April 10, 2016 16:25
Debug scala code using jdb
@umhan35
umhan35 / setup.sh
Last active March 28, 2016 19:31
virtualbox, ubuntu server, tinyos, genomote
x.org openbox
SLiM # not very needed
sudo apt-get install tinyos-tools
# also installs tinyos-source
sudo apt-get install gcc-msp430
cp -r tinyos-2.x/support/make/genomote* .
@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 / gist:8628318
Created January 26, 2014 04:11
treat bitbucket like github in `Gemfile`

Copy & paste the following to your Gemfile

def bitbucket repo; {git: 'ssh://git@bitbucket.org/'+repo} ;end

Usage

gem 'xxx', github('user/repo')