Skip to content

Instantly share code, notes, and snippets.

@markzyu
markzyu / mytests.cpp
Created May 19, 2015 01:36
Test the data structure you wrote in CS 225.
#include <iostream>
#include <string>
#include <sstream>
#include <map>
#include <vector>
#include <stdio.h>
#include <math.h>
#include <cstdlib>
// The following line includes your structure.
@markzyu
markzyu / ActionChain.java
Last active August 29, 2015 14:25
Guess how you can utilize this on Android! (Please use Java 7 and retrolambda for a nice lambda support. Java 8's lambda support might malfunction)
package zyu19.prototypes.paperplane.connect;
import java.util.ArrayList;
import zyu19.prototypes.paperplane.connect.config.*;
public class ActionChain<ThisType extends ActionChain> implements ErrorHolder, FakePromise<ThisType> {
//------------- public functions (ErrorHolder Interface) ----------------
@markzyu
markzyu / func11.cpp
Last active December 25, 2015 20:10
Testing C++11 functional
#include <iostream>
#include <string>
#include <functional>
using namespace std;
class TestScope
{
public:
int val;
@markzyu
markzyu / gist:6dd1b5d12d680f981432
Created February 18, 2016 06:20
Findings about Promise
// just run the following code in one line in node console
// The creator of Promise is responsible to report whether the 1st action is successful or not
// cases:
// neither fulfill nor rej is called -> the "then()"s will never be called and this promise is pending
// if fulfill is called -> the value put into fulfill() will be passed to the "then()" chains
// !! if one then() broke due to grammar or Runtime errors, following then()s will not execute, but
// any catch following that will execute
@markzyu
markzyu / mpromise.ts
Last active February 17, 2017 11:29
StateMonad for js Promise
// vim: expandtab ts=4 sw=4:
// Please compile using 'gulp', and 'gulp-typescript'
// This is the core of this library.
/*************************
Copyright (c) 2016 Zhongzhi Yu
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
@markzyu
markzyu / .emacs
Last active November 19, 2016 16:31
.emacs for OS X
(require 'package)
(add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/"))
(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/"))
(add-to-list 'package-archives '("melpa-stable" . "http://stable.melpa.org/packages/"))
(setq package-enable-at-startup nil)
(package-initialize)
(defun ensure-package-installed (&rest packages)
import java.io.IOException;
import java.util.StringTokenizer;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.Reducer;
@markzyu
markzyu / mirrorlist.mingw32
Created March 24, 2018 04:53 — forked from elvisw/mirrorlist.mingw32
MSYS2国内源
##
## 32-bit Mingw-w64 repository mirrorlist
## Changed on 2014-11-15
##
##中国科学技术大学开源软件镜像
Server = http://mirrors.ustc.edu.cn/msys2/REPOS/MINGW/i686
##北京理工大学镜像
Server = http://mirror.bit.edu.cn/msys2/REPOS/MINGW/i686
##日本北陆先端科学技术大学院大学 sourceforge 镜像
Server = http://jaist.dl.sourceforge.net/project/msys2/REPOS/MINGW/i686
@markzyu
markzyu / gist:e078b0b59651724207a72622b301ddf5
Created April 8, 2018 22:35
List of my public SSH keys.
# Macbook 2015
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDCtsAPfMtWcaDl/dFHy29kE4I5VfAYBrGgVRRt48PEITQUypo33sJXShtuCMqQu7VmcD4xpRgXwWfHOPx+4T88CJhGZ/fyEjC1gjVLyYZiMydhXs8rJzmS2ySzHQhHVfWJu5rmgxGv+9zySRfZj7Unezac1xwbkgQe4xqf8VX61ixrNgDXRBd6beGOUt/3rJ6PvPzm2JXrLcOWBaJu8KllcqM6Bhtifdb9mYPD5XajI9r8+HTqZy093pLPPAo/gdBNKtZJD1BaJXtCVOuOyy/NQj5C4KHXmsdLB2mkGpMzSsfXUHhAbiYOYk/tx3XDE9NFAkzFl+Ulx5+734cDlwFJ [email protected]