Skip to content

Instantly share code, notes, and snippets.

View hiepph's full-sized avatar

Hiep Pham hiepph

  • Netherlands
  • 06:45 (UTC +02:00)
View GitHub Profile
@hiepph
hiepph / cupy_install.md
Last active January 23, 2018 15:52
Cupy install Arch Linux
  • In /opt/cuda/include/crt/host_config.h, comment error for skipping GCC version checking:
#if __GNUC__ > 6

//#error -- unsupported GNU version! gcc versions later than 6 are not supported!

#endif /* __GNUC__ > 6 */
@hiepph
hiepph / deeptraffic.js
Last active January 17, 2018 14:07
Deep Traffic MIT 6.S094 (69.37 MPH)
//<![CDATA[
// a few things don't have var in front of them - they update already existing variables the game needs
lanesSide = 3;
patchesAhead = 50;
patchesBehind = 10;
trainIterations = 300000;
// the number of other autonomous vehicles controlled by your network
otherAgents = 3; // max of 9
@hiepph
hiepph / papers_2017.ipynb
Created December 29, 2017 06:53
Papers read in 2017
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@hiepph
hiepph / server.py
Created October 16, 2017 13:32
cGAN face generator
import os
import time
from flask import Flask, jsonify, request, redirect, url_for, send_file, make_response
from flask_cors import CORS, cross_origin
from options.test_options import TestOptions
from data.data_loader import CreateDataLoader
from models.models import create_model
import util.util as util
@hiepph
hiepph / gen.py
Created October 16, 2017 13:30
cGAN face generator - generate script
import os
from options.test_options import TestOptions
from data.data_loader import CreateDataLoader
from models.models import create_model
import util.util as util
if __name__ == "__main__":
if not os.path.exists('results'):
@hiepph
hiepph / simple_flask_server.py
Created October 16, 2017 13:19
Simple Flask server
import os
import time
from flask import Flask, jsonify, request, redirect, url_for, send_file, make_response
from flask_cors import CORS, cross_origin
# Config
app = Flask(__name__)
CORS(app)
app.config['UPLOAD_FOLDER'] = os.path.join(os.getcwd(), 'upload')
@hiepph
hiepph / macros.hpp
Last active September 29, 2017 09:18
C++ competitive macros
#include <bits/stdc++.h>
typedef unsigned int u;
// String
typedef string S
// Array
typedef S size
typedef PB push_back
@hiepph
hiepph / crawler.go
Created September 14, 2017 10:45
Pokemon crawlers
package main
import (
"database/sql"
"encoding/json"
"fmt"
"io"
"log"
"net/http"
"os"
@hiepph
hiepph / sample_concurr.ex
Created August 20, 2017 16:42
Concurrency example in Elixir
# spawn a new process
ponger = spawn(fn ->
receive do
{:ping, sender} ->
IO.puts "Ping"
send sender, :pong
end
end)
# send a :ping message to new process
import time
import math
import string
from utils import Util
from rnn import RNN, Model
def category_from_output(all_categories, output):
# Get index of greatest value
top_n, top_i = output.data.topk(1)