Skip to content

Instantly share code, notes, and snippets.

@alantian
alantian / tmux-cheatsheet.markdown
Created November 24, 2015 13:15 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@alantian
alantian / nvidia-gpu-sensor.pl
Created October 2, 2016 21:55 — forked from frantic1048/nvidia-gpu-sensor.pl
KDE KSysGuard NVIDIA GPU temperature sensor
#!/usr/bin/perl -w
# act as a KSysGuard sensor
# provides NVIDIA GPU temperature via `nvidia-settings`
# Usage
# 1. save this file, make sure it has a exec permission
# 2. in KSysGuard's menu, open `File` -> `Monitor Remote Machine`
# 3.1 in new dialog, type `Host` whatever you want
# 3.2 set `Connection Type` to `Custom command`
@alantian
alantian / nvidia-gpu-sensor.py
Created October 2, 2016 22:37
KDE KSysGuard NVIDIA GPU temperature sensor
#!/usr/bin/env python3
# KSysGard sensor for NVIDIA GPU temperature. Supports multiple GPUs.
# Needs: Python 3 and nvidia-smi
import subprocess
import xml.etree.ElementTree as ET
def get_xml_tree():
return ET.fromstring(subprocess.check_output(['nvidia-smi', '-q', '-x']))
@alantian
alantian / convert-to-utf8.ipynb
Created June 20, 2017 07:14
convert files to UTF-8, recursively.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@alantian
alantian / extract.py
Created June 21, 2017 06:17
extract dialogue.
import os
import re
from joblib import Parallel, delayed
def go_lines(lines):
flow = []
names = []
@alantian
alantian / convert_lmdb.py
Created July 16, 2017 12:18
Convert dataset to lmdb in parallel
#!/usr/bin/env python3
import argparse
import os
import sys
from os.path import basename
import cv2
import lmdb
import base64
import glob
import pickle
import pandas
import json
from collections import Counter
import os
from os.path import join
import shutil
games = pickle.load(open('../../data/game_face_170701/games.pickle', 'rb'), encoding='latin1')
tags = pickle.load(open('../../data/game_face_170701/tags.pickle', 'rb'), encoding='latin1')
@alantian
alantian / make_dataset.py
Created November 7, 2017 23:21
make dataset for official progressive gan code
#!/usr/bin/env python2
import os
import numpy as np
import h5py
import threading
import Queue
from PIL import Image
from tqdm import tqdm
from joblib import Parallel, delayed
@alantian
alantian / Dockerfile
Last active April 26, 2018 00:09
Dockerfile for running code built on some common deep learning frameworks.
FROM nvidia/cuda:9.0-cudnn7-devel-ubuntu16.04
#-------------------------------------------------------------------------------
### Enable UTF8 in docker instance
#-------------------------------------------------------------------------------
RUN apt-get update -y && \
apt-get install -y locales && \
rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/*
RUN locale-gen en_US.UTF-8
ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' LC_ALL='en_US.UTF-8'
@alantian
alantian / tensorboard_report.py
Created August 1, 2018 06:06
Chainer Extension that reports scalars to tensorboard
import os
import sys
from chainer.training import extension
from chainer.training.extensions import log_report as log_report_module
from chainer.training.extensions import util
import tensorflow as tf