brew install postgresql@9.6 brew install openssl
update ~/.bash_profile following the instraction that shows after installation above.
poetry install
" set | |
"set mouse=a | |
set mouse= | |
set number | |
set list | |
set listchars=tab:»-,trail:-,eol:↲,extends:»,precedes:«,nbsp:% | |
set expandtab | |
set tabstop=4 | |
set softtabstop=4 | |
set shiftwidth=0 |
# source .bashrc | |
test -r ~/.bashrc && . ~/.bashrc | |
# LANG | |
export LANG=en_US.UTF-8 | |
export LC_ALL=$LANG |
brew install postgresql@9.6 brew install openssl
update ~/.bash_profile following the instraction that shows after installation above.
poetry install
import requests | |
url = 'http://localhost:8000/xxx/unsubscribe/xxx' | |
session = requests.session() | |
res_get = session.get(url) | |
resp_post = session.post( | |
url, | |
data={"csrfmiddlewaretoken" : session.cookies['csrftoken']}, | |
headers={'referer': url} |
def sum(l: list): | |
if not l: | |
return 0 | |
i = l.pop() | |
return sum(l) + i | |
print(sum([1,2,3,4,5])) | |
# 15 |
var Person = { | |
init: function() { | |
this.first_name = ''; | |
this.last_name = ''; | |
return this; | |
}, | |
getFullName: function() { | |
return this.first_name + ' ' + this.last_name; | |
}, | |
}; |
-- https://www.postgresql.org/docs/9.5/functions-json.html | |
WITH | |
virtual_table AS (SELECT key, value FROM jsonb_each('{"k": {"sub_key": 10}, "k2": {"sub_key": 20}}')), | |
extracted_values AS (SELECT value->'sub_key' AS sub_key FROM virtual_table) | |
SELECT * FROM extracted_values |
import time | |
from threading import Thread, BoundedSemaphore | |
MAX_CONCURRENT_THREADS = 3 | |
thread_limiter = BoundedSemaphore(value=MAX_CONCURRENT_THREADS) | |
class MyThread(Thread): | |
def run(self): | |
thread_limiter.acquire() |
"""Slack notification | |
This needs: | |
- requests==2.11.1 | |
- slackclient==1.3.1 | |
""" | |
import logging | |
import os | |
from socket import gethostname |