Skip to content

Instantly share code, notes, and snippets.

View eugene123tw's full-sized avatar

Eugene Liu eugene123tw

View GitHub Profile
@eugene123tw
eugene123tw / min-char-rnn.py
Created October 21, 2017 00:57 — forked from karpathy/min-char-rnn.py
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
@eugene123tw
eugene123tw / Dataloader.py
Created November 23, 2017 08:16
Dataloader.py
import numpy as np
import pickle
class ImageDataset():
def __init__(self, datasets, transform=[], type='train', resize = False):
super(ImageDataset, self).__init__()
with open(datasets, mode='rb') as f:
datasets = pickle.load(f)
import pickle
import numpy as np
from data_processor import *
import tensorflow as tf
from tool import *
from model import LeNet
def detect():
### Replace each question mark with the appropriate value.
### Use python, pandas or numpy methods rather than hard coding the results
@eugene123tw
eugene123tw / multiple_gcc.MD
Created September 2, 2018 20:51
How to use multiple instances of gcc?

How to use multiple instances of gcc?

You need to let update-alternatives to know that you have 2 C/C++ compilers, create a record for each one, and then configure which one you want to use.

This is done with the following:

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.7 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.7
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 40 --slave /usr/bin/g++ g++ /usr/bin/g++-4.8
sudo update-alternatives --config gcc
@eugene123tw
eugene123tw / .bashrc
Created March 19, 2019 10:06
git prompt
export PS1='\[\033[0;32m\]\[\033[0m\033[0;32m\]\u\[\033[0;36m\] @ \[\033[0;36m\]\h \w\[\033[0;32m\]$(__git_ps1)\n\[\033[0;32m\]└─\[\033[0m\033[0;32m\] \$\[\033[0m\033[0;32m\] ▶\[\033[0m\] '
@eugene123tw
eugene123tw / gitflow-breakdown.md
Created July 22, 2019 08:42 — forked from JamesMGreene/gitflow-breakdown.md
A comparison of using `git flow` commands versus raw `git` commands.

Initialize

gitflow git
git flow init git init
  git commit --allow-empty -m "Initial commit"
  git checkout -b develop master

Connect to the remote repository

@eugene123tw
eugene123tw / Django EC2 Bad Request (400)
Created March 13, 2020 15:04 — forked from eezis/Django EC2 Bad Request (400)
Resolving Bad Request (400) when using Django on an EC2 instance DEBUG
This gist pertains to a Bad Request(400) error when trying to access an EC2 instance running django . . .
I set up an EC2 server, installed django, started runserver and tested. The result was
Bad Request (400)
When using Django 1.5 and higher, when DEBUG=False in the settings.py file, you must specify ALLOWED_HOSTS
or you will recieve a "Bad Request (400)" error message when attempting to retrieve a page.
On an Amazone EC2 instance, if you are testing with the public DNS, then you should put the public DNS in
@eugene123tw
eugene123tw / postgres-brew.md
Last active April 5, 2020 11:18 — forked from ibraheem4/postgres-brew.md
Installing Postgres via Brew (OSX)

Installing Postgres via Brew

Pre-Reqs

Brew Package Manager

In your command-line run the following commands:

  1. brew doctor
  2. brew update
@eugene123tw
eugene123tw / c_cpp_properties.json
Last active April 16, 2020 13:52
PyTorch VSCode c-cpp properties
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**",
"/usr/include/python3.6m",
"/usr/local/cuda-10.0/targets/x86_64-linux/include",
"{PYTORCH_ENV}/lib/python3.6/site-packages/torch/include",
"{PYTORCH_ENV}/lib/python3.6/site-packages/torch/include/torch/csrc/api/include",
@eugene123tw
eugene123tw / t-ortcpu.cc
Created September 9, 2021 20:06 — forked from pranavsharma/t-ortcpu.cc
onnxruntime C++ API inferencing example for CPU
// Copyright(c) Microsoft Corporation.All rights reserved.
// Licensed under the MIT License.
//
/*
pranav@XXX:~$ wget https://github.com/microsoft/onnxruntime/releases/download/v1.8.1/onnxruntime-linux-x64-1.8.1.tgz
....
2021-07-28 19:44:06 (7.60 MB/s) - ‘onnxruntime-linux-x64-1.8.1.tgz’ saved [4736207/4736207]
pranav@XXX:~$ tar xvfz onnxruntime-linux-x64-1.8.1.tgz