Skip to content

Instantly share code, notes, and snippets.

@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){
#include<iostream>
#include<string>
#include<fstream>
#include<cstdlib>
#include<cstring>
#include<vector>
#include<utility>
#include<unistd.h>
#include<algorithm>
using namespace std;
@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) {
@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 / 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 / speed_test.py
Created September 21, 2017 07:47
python list of lists speed
import random
import time
batch_size = 256
def merge1(l):
l = l / batch_size * batch_size
manifest = range(0, l)
batch_manifest = zip(*[iter(manifest)] * batch_size)
start_time = time.time()
@lispc
lispc / multisig.sh
Last active April 3, 2019 07:48
multi sig demo for IOST
set -eu
pubkey1=2ott3o9CZcaoZCe4nGYo1azEfEpY4W771GBFe133WW1p
seckey1=3MWryACc5nSxRDJCJLe9Xq2spR1j7d5wYbZ4pZN4SvfgUxhG497DQxo5ahENoCnDkLsc7haSveP1q1zkt26JWhog
pubkey2=G7Zy3ctcByrWfzCzkijnmPXm2rxjQruttFg9FH3hJSMw
seckey2=3NdYa9gCfsRpJMzQZWXfLhKegA4kpyKjYpDLxSCv3hnSX4homFS5T91guU6TGasmrU4Cei9WsNn3hA1cFHZnxKtm
pubkey3=D4WgA3Q9EV18S78haqYpdBqJZT3TNCgkraczi8PK4TVE
seckey3=4RQrGu6ZdKdNP21jQpbMjLMRGdhSemZf1xQXVsm6wJztmWXAm828qhmae6SoQjTU1H64box1Ha2cJgTDntj7Ud2
pubkey4=HiE2gyeFeSoWzurFTWdFnNLizuigh93Jh97HisnQ2see
seckey4=3zXxqsvNTfcB3Ah9JCyX2mqYxRmMoGGu7i1jEnykkoc58ikGo6eoDXJTqpn8Yabt5mGkGd51atkzVafFyeTgwp6i
function init() {
iwallet --account admin account create lispc --initial_balance 100
iwallet --account admin account create lispcc --initial_balance 100
iwallet --account lispc sys pledge 10 --gas_user lispcc
iwallet --account lispc sys pledge 10 --gas_user lispc
iwallet --account lispc sys unpledge 10 --gas_user lispc
iwallet --account lispc sys pledge 10 --gas_user lispc
}
init
curl -s -X POST --data '{"id":"gas.iost","key":"lispcgp"}' http://127.0.0.1:30001/getContractStorageFields
@lispc
lispc / multi_sig.sh
Last active January 16, 2020 08:08
IOST multiple signature
set -eu
TEST_USER_ID="testname"
GROUP="group"
IWALLET_CMD='iwallet --chain_id 1020 -s 127.0.0.1:30002' # single node dev chain
seckey1=3MWryACc5nSxRDJCJLe9Xq2spR1j7d5wYbZ4pZN4SvfgUxhG497DQxo5ahENoCnDkLsc7haSveP1q1zkt26JWhog
pubkey1=2ott3o9CZcaoZCe4nGYo1azEfEpY4W771GBFe133WW1p
function clean_account() {
$IWALLET_CMD account del $TEST_USER_ID

Keybase proof

I hereby claim:

  • I am lispc on github.
  • I am lispczz (https://keybase.io/lispczz) on keybase.
  • I have a public key ASAbA6xwLhete1bhdoOwyjLFqaVeIOwpYKhhb65QwKFUJgo

To claim this, I am signing this object: