Skip to content

Instantly share code, notes, and snippets.

@BassyKuo
BassyKuo / stage.hh.diff
Created February 23, 2019 17:42
The patch file for stage.hh, please apply the patch with the command `patch <original_file> <patch_file>`. More information: https://github.com/rtv/Stage/issues/64
@@ -622,46 +622,46 @@
{ cont.erase( std::remove( cont.begin(), cont.end(), thing ), cont.end() ); }
// Error macros - output goes to stderr
-#define PRINT_ERR(m) fprintf( stderr, "\033[41merr\033[0m: "m" (%s %s)\n", __FILE__, __FUNCTION__)
-#define PRINT_ERR1(m,a) fprintf( stderr, "\033[41merr\033[0m: "m" (%s %s)\n", a, __FILE__, __FUNCTION__)
-#define PRINT_ERR2(m,a,b) fprintf( stderr, "\033[41merr\033[0m: "m" (%s %s)\n", a, b, __FILE__, __FUNCTION__)
-#define PRINT_ERR3(m,a,b,c) fprintf( stderr, "\033[41merr\033[0m: "m" (%s %s)\n", a, b, c, __FILE__, __FUNCTION__)
-#define PRINT_ERR4(m,a,b,c,d) fprintf( stderr, "\033[41merr\033[0m: "m" (%s %s)\n", a, b, c, d, __FILE__, __FUNCTION__)
-#define PRINT_ERR5(m,a,b,c,d,e) fprintf( stderr, "\033[41merr\033[0m: "m" (%s %s)\n", a, b, c, d, e, __FILE__, __FUNCTION__)
@BassyKuo
BassyKuo / CityScapes_IndexLabels.txt
Last active June 12, 2018 14:22
VOC2012/CityScapes/ADE20k labels
000 road
001 sidewalk
002 building
003 wall
004 fence
005 pole
006 traffic light
007 traffic sign
008 vegetation
009 terrain
#!/usr/bin/env python3
import tensorflow as tf # tf.VERSION == 1.4.0
from tensorflow.contrib.tensorboard.plugins import projector
# ... write something here ...
dx, x_embedding = discriminator(x, is_training=True)
dz, z_embedding = discriminator(z, is_training=True)
@BassyKuo
BassyKuo / getpasswd
Created May 5, 2018 18:34
Generate random password.
#!/bin/bash
#
# Uasge:
# getpasswd 64 ~/.vnc/passwd
#
length=${1:-128}
passwdfile=${2:-$HOME/.vnc/passwd}
if su -c true $USER ; then
head /dev/urandom | tr -dc 0-9a-zA-Z_ | head -c $length | tee /dev/tty | /usr/bin/vncpasswd -f > $passwdfile
#!/usr/bin/env python3
import threading
import GPUtil
import numpy as np
gpu_loading = []
num_threads = 2
th = {}
@BassyKuo
BassyKuo / tf_orthogonal_initializer_test.py
Created October 30, 2017 16:46
Testing: Tensorflow orthogonal initializer
import tensorflow.contrib.slim as slim
import tensorflow as tf
import numpy as np
d_w_initializer = tf.orthogonal_initializer(1.0)
def discriminator(inputs, phase_train=True, reuse=False, use_bias=False, name="deGAN_d"):
net = inputs
pack = (
# [128, tf.nn.relu, d_w_initializer],
[128, tf.nn.relu, d_w_initializer],
[1, None, d_w_initializer]
label count
0 2600
1 2600
2 2600
3 2600
4 2600
5 2300
6 2600
7 2600
8 2600
@BassyKuo
BassyKuo / hello_threading.py
Last active July 24, 2017 15:15
hello_threading.py
#!/usr/bin/env python3
import threading
num_threads = 5
th = {}
def main():