This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Updated: Aug. 15, 2024 | |
// Run: node testRegex.js testText.txt | |
// Used in https://jina.ai/tokenizer | |
const fs = require('fs'); | |
const util = require('util'); | |
// Define variables for magic numbers | |
const MAX_HEADING_LENGTH = 7; | |
const MAX_HEADING_CONTENT_LENGTH = 200; | |
const MAX_HEADING_UNDERLINE_LENGTH = 200; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mods = { | |
"resnet50": (torchvision.models.resnet50, 2048), | |
"resnet152": (torchvision.models.resnet152, 2048), | |
"densenet121": (torchvision.models.densenet121, 1024*7*7), | |
"densenet201": (torchvision.models.densenet201, 1920*7*7), | |
"vgg16": (torchvision.models.vgg16, 512*7*7), | |
} | |
MOD = "densenet201" | |
class Fusion2Model(nn.Module): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LAMBDA_REPO=$(mktemp) && \ | |
wget -O${LAMBDA_REPO} https://lambdalabs.com/static/misc/lambda-stack-repo.deb && \ | |
sudo dpkg -i ${LAMBDA_REPO} && rm -f ${LAMBDA_REPO} && \ | |
sudo apt-get update && sudo apt-get install -y lambda-stack-cuda |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
here is my application scenario: assuming there is a table in mysql, named orders including 4 fields(id, orderid, money, type), everytime I pick the last item of each orderid to manipulate. For examle, i choose one order whose orderid=777, i.e. this item (3, 777, 34.00, 1), to consume $2.00. Then this item firstly is changed into (3, 777, 34.00, 0), and then I insert one row into the table (4, 777, 32.00, 1). | |
But with the concurrency, there are probably two sessions to select the item(3, 777, 34.00, 1) at the same time, then consume $2.00 based on the same item. Now I totally have items (3, 777, 34.00, 0), (4, 777, 32.00, 1), (5, 777, 32.00, 1). Normally, everytime it should consume money based on the very last item of the order, i.e., (3, 777, 34.00, 0), (4, 777, 32.00, 0), (5, 777, 30.00, 1) | |
last = getInfoByOrderId(orderid, type); | |
//... | |
// if last does not satisfy some conditon, then return or throw exceptions directly | |
//... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
explain select * from amortize_order_info_3 force index(PRIMARY) where source_sys = 'pmc' and order_create_gmt >= '2016-03-08 00:00:00' and order_create_gmt<= '2016-03-08 23:59:59' and id >10152664498617 order by id asc limit 1000; | |
+----+-------------+-----------------------+-------+---------------+---------+---------+------+----------+-------------+ | |
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | | |
+----+-------------+-----------------------+-------+---------------+---------+---------+------+----------+-------------+ | |
| 1 | SIMPLE | amortize_order_info_3 | range | PRIMARY | PRIMARY | 8 | NULL | 30924473 | Using where | | |
+----+-------------+-----------------------+-------+---------------+---------+---------+------+----------+-------------+ |