Skip to content

Instantly share code, notes, and snippets.

@lispc
lispc / queue.py
Last active April 29, 2017 08:54
Tensorflow FIFOQueue bug
from __future__ import print_function
import os
os.environ["CUDA_VISIBLE_DEVICES"]=''
import time
import threading
import numpy as np
import tensorflow as tf
queue_size = 10
queue_shape = [6, 200, 200, 3]
cluster_spec_config = {'train': ['localhost:22222', 'localhost:23333']}
@lispc
lispc / py
Created November 28, 2016 15:51
Tensorflow FIFOQueue speed
import tensorflow as tf
import time
from datetime import datetime
import numpy as np
FLAGS = tf.app.flags.FLAGS
tf.app.flags.DEFINE_bool('cluster', False, '')
def log(obj):
print datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S.%f')[:-3], obj
@lispc
lispc / gist:924eb2514d1caa39ab36
Last active August 29, 2015 14:03
Gas Station Leetcode
class Solution {
public:
int pw(int a,int b){
if(b==0){
return 1;
}
int half = pw(a,b/2);
return half*half*(b%2?a:1);
}
int canCompleteCircuit(vector<int> &gas, vector<int> &cost) {
#include<iostream>
#include<string>
#include<fstream>
#include<cstdlib>
#include<cstring>
#include<vector>
#include<utility>
#include<unistd.h>
#include<algorithm>
using namespace std;
@lispc
lispc / Right
Created April 20, 2014 14:17
The Js bug
var descriptionDisplayLimit = 200;
var ids = [];
var simly = Simly.getInstance();
templateFunc = swig.compile($("#src_item_template").html());
function load_log(){
$.ajax({
url: "/simly/api/get_feedback_log",
dataType: "json",
data: {uname:getLoginInfo().username},
success:function(res){