Skip to content

Instantly share code, notes, and snippets.

// searches MongoDb for all users with a rank limit 10000
User.aggregate([
{
$project: {
_id: "$_id",
rank: "$rank"
}
},
{
$match: {
// unset all users' rank from db
await User.bulkWrite([{updateMany : {
filter: { rank: {$exists: true}},
update: { $unset: { rank: 1 } }
}
}])
@songthamtung
songthamtung / textract_s3.py
Last active September 17, 2019 04:46
AWS Python SDK Textract x s3
#!/usr/bin/env python3
# Detects text in a document stored in an S3 bucket.
import boto3
import sys
from time import sleep
import math
import pandas as pd
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
author = getAuthor();
title = `my-app by ${this.author}`;
48 Laws of Power - Robert Greene
Be Here Now - Ram Dass
Extreme Ownership - Jocko Willink and Leif Babin
How to Eat - Thich Nhat Hanh
How to Win Friends & Influence People - Dale Carnegie
Radical Focus - Christina Wodtke
ReWork - Jason Fried & David Hansson
Sapiens - Yuval Noah Harari
Shantaram - Gregory David Roberts
Soft Skills - John Sonmez
import requests
from bs4 import BeautifulSoup
result = requests.get("https://www.webscraper.io/test-sites/e-commerce/allinone")
soup = BeautifulSoup(result.content)
links = soup.find_all("a", "title")
data = {}
for link in links:
title = link.string
data[title] = link.attrs['href']
😀 :smile
😬 :simply
version: 0.2
env:
variables:
CACHE_CONTROL: "86400"
S3_BUCKET: "{{your_url}}"
BUILD_FOLDER: "dist"
phases:
install:
runtime-versions:
class Ceo:
__instance = None
def getInstance():
if Ceo.__instance == None:
Ceo()
return Ceo.__instance
def __init__(self):
if Ceo.__instance != None:
{
"type": "mysql",
"host": "localhost",
"port": 3306,
"username": "test",
"password": "test",
"database": "test",
"synchronize": true,
"logging": false,
"entities": [