Skip to content

Instantly share code, notes, and snippets.

View ppwwyyxx's full-sized avatar
🎯
Focusing

Yuxin Wu ppwwyyxx

🎯
Focusing
View GitHub Profile
@ppwwyyxx
ppwwyyxx / reverse_iterator.cpp
Last active April 20, 2020 21:32
C++11 Reverse Iterator Used in Ranged For Loop
//File: reverse_iterator.cpp
//Date: Thu Jul 17 09:54:05 2014 -0700
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <cstdio>
#include <limits>
using namespace std;
@ppwwyyxx
ppwwyyxx / smallpt.cc
Last active August 7, 2016 17:41
A cleaner version of smallpt
#include <math.h> // smallpt, a Path Tracer by Kevin Beason, 2008
#include <stdlib.h> // Make : g++ -O3 -fopenmp smallpt.cpp -o smallpt
#include <stdio.h> // Remove "-fopenmp" for g++ version < 4.2
struct Vec { // Usage: time ./smallpt 5000 && xv image.ppm
double x, y, z; // position, also color (r,g,b)
Vec(double x_ = 0, double y_ = 0, double z_ = 0) {
x = x_;
y = y_;
z = z_;
}
set scalehints
set noautofocus
set showtabindices
"set defaultnewtabpage
let mapleader = ","
let highlight = '#d28ce3'
let activehighlight = '#0ff3db'
let qmark g = ["http://google.com"]
let blacklists = ["*://mail.google.com/*"]
map gm :tabnew mail.google.com&<CR>
### Keybase proof
I hereby claim:
* I am ppwwyyxx on github.
* I am ppwwyyxx (https://keybase.io/ppwwyyxx) on keybase.
* I have a public key whose fingerprint is AEA1 11B6 420F 3D2A DE8B 6919 6FC3 FF92 B88D D8A0
To claim this, I am signing this object:
@ppwwyyxx
ppwwyyxx / tensorpack-gym.md
Last active May 23, 2018 09:29
placeholder for OpenAI Gym submission

Use A3C (asynchronous advantage actor-critic) written in TensorFlow. Training code, model & evaluation code at this repo

Gist doesn't have notifications, please use repo issues to discuss.

@ppwwyyxx
ppwwyyxx / f1.diff
Last active June 23, 2017 00:03
Patch f1 (https://github.com/ebonyclock/vizdoom_cig2017) to work under latest TensorFlow + latest tensorpack
diff --git i/f1/F1_track1/agent.py w/f1/F1_track1/agent.py
index a717842..4ae8405 100644
--- i/f1/F1_track1/agent.py
+++ w/f1/F1_track1/agent.py
@@ -140,15 +140,15 @@ class FinalEnv(RLEnvironment):
class Model(ModelDesc):
- def _get_input_vars(self):
- return [InputVar(tf.float32, (None,) + IMAGE_SHAPE3, 'image'),
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# File: CycleGAN-replaybuffer.py
import os, sys
import argparse
import glob
from six.moves import map, zip, range
from collections import deque
import numpy as np
@ppwwyyxx
ppwwyyxx / Android.mk
Created February 6, 2018 18:01 — forked from ChiChou/Android.mk
WeChat dump
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := loader
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := loader.c
LOCAL_CPPFLAGS := -std=gnu++0x -Wall
LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -llog -pie -fPIE
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
A general curve plotter to create curves such as:
https://github.com/ppwwyyxx/tensorpack/tree/master/examples/ResNet
A simplest example:
$ cat examples/train_log/mnist-convnet/stat.json \
| jq '.[] | .train_error, .validation_error' \
@ppwwyyxx
ppwwyyxx / benchmark.py
Created April 27, 2019 01:04
Serialization Benchmark
"""
Dependencies:
pip install \
tabulate ujson msgpack msgpack_numpy numpy pyarrow
"""
import sys
from timeit import timeit
import pickle