Skip to content

Instantly share code, notes, and snippets.

View yuq-1s's full-sized avatar
:octocat:
Working in the lab

Yuquan Wang yuq-1s

:octocat:
Working in the lab
  • Tsinghua University
  • Beijing
View GitHub Profile
@yuq-1s
yuq-1s / rmemptyline.ps1
Created July 17, 2018 03:00
eliminate all empty lines of all python files in a directory in powershell
Get-ChildItem -path "C:\path\to\my\directory" -recurse -Include *.py |
ForEach-Object {
(gc $_.FullName) | ? {$_.trim() -ne ""} | Set-Content $_.FullName
}
@yuq-1s
yuq-1s / bashenv.sh
Created July 7, 2018 10:07
My bash environment variables
# export all_proxy='socks5://127.0.0.1:1080'
# export ALL_PROXY='socks5://127.0.0.1:1080'
MUJOCO_PY_MJPRO_PATH="$HOME/.mujoco/mjpro131/bin"
export all_proxy=''
export ALL_PROXY=''
export PATH="$HOME/bin/:$MUJOCO_PY_MJPRO_PATH:/usr/local/cuda/bin:$PATH"
export MUJOCO_PATH="$HOME/bin/mjpro140"
# export GTEST_DIR="$HOME/lib/googletest/googletest"
# export GMOCK_DIR="$HOME/lib/googletest/googlemock"
@yuq-1s
yuq-1s / vimrc
Created July 7, 2018 10:00
My vimrc
" Leader
let mapleader = " "
set backspace=2 " Backspace deletes like most programs in insert mode
set nobackup
set nowritebackup
set noswapfile " http://robots.thoughtbot.com/post/18739402579/global-gitignore#comment-458413287
set history=50
set ruler " show the cursor position all the time
set showcmd " display incomplete commands
@yuq-1s
yuq-1s / recover.sh
Last active July 3, 2018 00:06
The way I set up a new Ubuntu 16.04 when Windows Update kills all my data
# disable system problem detected
sudo sed -i 's/enabled=1/enabled=0/' /etc/default/apport
# update and install necessary software
## shadowsocks-libev
sudo apt-get install software-properties-common -y
sudo add-apt-repository ppa:max-c-lv/shadowsocks-libev -y
sudo apt-get update
@yuq-1s
yuq-1s / find_first_nan.py
Created May 15, 2018 12:43
Find first n appearances of tensors containing Nans for TensorFlow.
#! /usr/bin/env python3
import os
import tensorflow as tf
import numpy as np
import tempfile
from tensorflow.python import debug as tfdbg
def watch_session(dump_root_dir, train_op, times):
''' Dump tensors to temperary directory for analysis'''
@yuq-1s
yuq-1s / setup-sjtu-vpn.sh
Last active February 15, 2022 08:06
Setup SJTU VPN connection from Ubuntu 16.04 desktop
# Install dependencies
sudo apt install libcurl4-openssl-dev iptables-dev autoconf libgmp3-dev libssl-dev pkg-config
# Install StrongSwan
wget http://download.strongswan.org/strongswan-5.6.1.tar.bz2
tar xjvf strongswan-5.6.1.tar.bz2 && cd strongswan-5.6.1
# FIXME: Some of these options may be redundant, but they work on my laptop.
autoconf && ./configure \
--prefix=/usr/local \