Skip to content

Instantly share code, notes, and snippets.

View frankyaorenjie's full-sized avatar
🎯
Focusing

Yao Ren Jie姚仁捷 frankyaorenjie

🎯
Focusing
  • ViSenze
  • Singapore
View GitHub Profile
@frankyaorenjie
frankyaorenjie / Dockerfile
Last active February 7, 2024 18:02
[Pass parameters from docker run to python] #docker #dockerfile
FROM python:3.6
ENV LC_ALL C.UTF-8
ENV LANG C.UTF-8
ENV GOOGLE_APPLICATION_CREDENTIALS /service/scripts/application_default_credentials.json
COPY . /service/scripts
WORKDIR /service/scripts
RUN pip install pipenv
@frankyaorenjie
frankyaorenjie / batchgetitem.py
Last active August 20, 2018 11:44
[python3 boto for dynamodb] #aws #dynamodb #python
response = dynamodb.batch_get_item(
RequestItems={
'visearch_production_meta': {
'Keys': batch_i_tx_j_list,
'ProjectionExpression': 'm,nd,nk'
}
}
)
dynamodb_results.extend(response['Responses']['visearch_production_meta'])
@frankyaorenjie
frankyaorenjie / dump_and_restore.sh
Created July 25, 2018 13:34
[mongodb snippets] #mongodb
# source database: rec_prod, collection: rec_history
# dest database: recognition, collection: recognition_history
mongodump --host rec-shard-0/rec-shard-00-00-cudev.mongodb.net:27017,rec-shard-00-01-cudev.mongodb.net:27017,rec-shard-00-02-cudev.mongodb.net:27017 --ssl --username renjie --password <PASSWORD> --authenticationDatabase admin --db rec_prod -c rec_history -o ./dump/ -q '{timestamp: {$gte: ISODate("2017-08-01T00:00:00.000Z"), $lt: ISODate("2017-09-01T00:00:00.000Z")}}'
mongorestore --host visenze/mongodb-0.data.visenze.com:27017,mongodb-1.data.visenze.com:27017,mongodb-2.data.visenze.com:27017 --username data_api_rw --password <PASSWORD> --authenticationDatabase annotation -d recognition -c recognition_history ./dump/rec_prod/rec_history.bson
.title-button {
display: flex;
cursor: pointer;
margin: 10px;
color: #ababab;
flex-direction: column;
justify-content: center;
height: 100%;
&:hover {
color: white;
@frankyaorenjie
frankyaorenjie / curl.sh
Created October 11, 2018 07:26
[curl] #shell #curl
curl \
-s \
-x $proxy \
--max-time $TIMEOUT $url \
-w "$port\t%{time_total}\t%{time_namelookup}\t%{http_code}\t%{size_download}\n" \
-o /dev/null
@frankyaorenjie
frankyaorenjie / utils.ts
Created November 29, 2018 03:07
utils #nodejs #typescriopt
import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root',
})
export class Utils {
uniqArray(a: object[]) {
return Array.from(new Set(a));
}