This file contains 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
import { Injectable } from '@angular/core'; | |
@Injectable({ | |
providedIn: 'root', | |
}) | |
export class Utils { | |
uniqArray(a: object[]) { | |
return Array.from(new Set(a)); | |
} |
This file contains 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
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 |
This file contains 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
.title-button { | |
display: flex; | |
cursor: pointer; | |
margin: 10px; | |
color: #ababab; | |
flex-direction: column; | |
justify-content: center; | |
height: 100%; | |
&:hover { | |
color: white; |
This file contains 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
# 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 |
This file contains 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
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']) |
This file contains 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
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 |
This file contains 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
// read big file | |
split -l 500000 query_log_distinct_6m.csv split_files/ |
This file contains 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
# parallel download | |
cat /tmp/urls.txt | parallel -j 100 wget --timeout=2 -q {} |
This file contains 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
SELECT | |
table_id, | |
SUM(size_bytes)/POW(10,9) AS size | |
FROM | |
`data-platform-163807.raw_logs.__TABLES__` | |
WHERE | |
table_id LIKE '%20190101' | |
GROUP BY | |
table_id | |
ORDER BY |
This file contains 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
#V2 is branch name | |
#upstream is remote name | |
git push upstream HEAD:V2 |
NewerOlder