Skip to content

Instantly share code, notes, and snippets.

View jeasinema's full-sized avatar
💭
I may be slow to respond.

Xiaojian Ma jeasinema

💭
I may be slow to respond.
View GitHub Profile
export CUDA_HOME=$HOME/tools/cuda-9.0 # change to your path
export CUDA_TOOLKIT_ROOT_DIR=$CUDA_HOME
export LD_LIBRARY_PATH="$CUDA_HOME/extras/CUPTI/lib64:$LD_LIBRARY_PATH"
export LIBRARY_PATH=$CUDA_HOME/lib64:$LIBRARY_PATH
export LD_LIBRARY_PATH=$CUDA_HOME/lib64:$LD_LIBRARY_PATH
export CFLAGS="-I$CUDA_HOME/include $CFLAGS"
export PATH="$CUDA_HOME/bin:$PATH"
@jeasinema
jeasinema / NoteDup_patched
Last active October 12, 2020 21:45
Remove the yinxiang->evernote warning of NoteDup (https://github.com/ppyyf/notedup-bin)
java -jar notedup_patched.jar
import torch
import numpy as np
import argparse
from torchvision import models
import matplotlib.pyplot as plt
import cv2
import os
resnet = models.resnet50(pretrained=True)
@jeasinema
jeasinema / imagenet1000_clsidx_to_labels.txt
Created June 27, 2019 05:46 — forked from yrevar/imagenet1000_clsidx_to_labels.txt
text: imagenet 1000 class idx to human readable labels (Fox, E., & Guestrin, C. (n.d.). Coursera Machine Learning Specialization.)
{0: 'tench, Tinca tinca',
1: 'goldfish, Carassius auratus',
2: 'great white shark, white shark, man-eater, man-eating shark, Carcharodon carcharias',
3: 'tiger shark, Galeocerdo cuvieri',
4: 'hammerhead, hammerhead shark',
5: 'electric ray, crampfish, numbfish, torpedo',
6: 'stingray',
7: 'cock',
8: 'hen',
9: 'ostrich, Struthio camelus',
@jeasinema
jeasinema / jeasinema.sty
Last active May 12, 2019 07:41
Some useful macros for writing technical papers
% packages
\usepackage{amsmath,amsfonts,amssymb,amsthm}
\usepackage{hyperref}
\usepackage{xspace}
\usepackage{algorithm}
\usepackage{algorithmic}
\usepackage{color}
\usepackage{graphicx}
\usepackage{mathtools}
\usepackage{footmisc}
@jeasinema
jeasinema / create_legend.py
Last active September 2, 2019 06:53
Create customized legend
import matplotlib.pyplot as plt
from matplotlib.lines import Line2D
import seaborn as sns
import numpy as np
fig = plt.figure()
fig.set_size_inches(18, 3)
ax = fig.subplots(1)
label = ['Expert', 'Demo', 'Pre-train', 'POfD', 'Penalty', 'Penalty + Ann.', 'Ours']
flatui = ["#9b59b6", "#999900", "#3498db", "#95a5a6", "#009900", "#fc9272", "#e74c3c"]
clrs = sns.color_palette(flatui)
@jeasinema
jeasinema / transmission-daemon-quickstart.md
Created February 10, 2019 09:31 — forked from eriknomitch/transmission-daemon-quickstart.md
Transmission Daemon (transmission-daemon) Quickstart

Transmission Daemon (transmission-daemon) Quickstart

This should work for Debian or Debian-deriviants (e.g., Ubuntu)

Quickstart

Install transmission-daemon

sudo apt-get install transmission-daemon
@jeasinema
jeasinema / dm_control_to_gym.py
Last active October 16, 2018 04:00
Wrap DeepMind dm_control into OpenAI gym
#!/usr/bin/env python
# -*- coding:UTF-8 -*-
# File Name : dm_control_wrapper.py
# Creation Date : 09-10-2018
# Created By : Jeasine Ma [jeasinema[at]gmail[dot]com]
import glfw
try:
glfw.init()
except:
@jeasinema
jeasinema / nm_l2tp_ipsec_vpn.md
Created October 3, 2018 00:13 — forked from pastleo/nm_l2tp_ipsec_vpn.md
setup L2TP IPSEC VPN in archlinux using NetworkManager

setup L2TP IPsec VPN in archlinux using NetworkManager

install networkmanager-l2tp first:

yaourt -S networkmanager-l2tp

then reboot or systemctl restart NetworkManager

@jeasinema
jeasinema / smooth_plot.py
Last active February 26, 2019 08:15
Plot smooth curve like other people do
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
def smooth(y, box_pts):
box_pts = max(box_pts, 1) if len(y) > box_pts else 1
box = np.ones(box_pts)/box_pts
y_smooth = np.convolve(y, box, mode='valid')
return y_smooth