Skip to content

Instantly share code, notes, and snippets.

View tlylt's full-sized avatar

Liu Yongliang tlylt

View GitHub Profile
celery -A project-name worker --pool=solo -l info
\du
ALTER USER yourusername WITH PASSWORD 'yournewpass';
CREATE USER yourname WITH SUPERUSER PASSWORD 'yourpassword';
https://www.makeareadme.com/
# Foobar
Foobar is a Python library for dealing with word pluralization.
## Installation
Use the package manager [pip](https://pip.pypa.io/en/stable/) to install foobar.
```bash
# remove local branch
git branch -d branchname
https://serverfault.com/questions/110154/whats-the-default-superuser-username-password-for-postgres-after-a-new-install
In Windows, do the following (IMPORTANT: Use a Windows administrator account):
After installation, open <PostgreSQL PATH>\data\pg_hba.conf.
Modify these two lines, and change "md5" to "trust":
host all all 127.0.0.1/32 md5
host all all ::1/128 md5
# create virtual environment in this folder called env
python -m venv env
# activate it
env\Scripts\activate.bat
def make_datetime(string): # provided
string = string.split(' ')
date_str = string[0].split('/')
time_str = string[1].split(':')
date_int = [int(x) for x in date_str]
time_int = [int(x) for x in time_str]
return datetime.datetime(date_int[2], date_int[1], date_int[0], time_int[0], time_int[1])
def read_csv(filename): # provided
with open(filename, 'r') as f:
lines = csv.reader(f, delimiter=',')
return tuple(lines)
@tlylt
tlylt / Fixing 413 Request Entity Too Large (Nginx)
Last active May 19, 2020 13:09
Fixing 413 Request Entity Too Large (Nginx)
# You probably need to set a size that is way larger than expected file size,
# if not you still may receive this 413 Request entity too large error
server {
client_max_body_size 100M;
...
}
# Number of Combinations = 2**(length of input set)
# Makes use of binary
def PowerSet(input):
ans = []
numOfComb = 2 ** len(input)
for combidx in range(numOfComb): # 0 -> numOfComb
temp = []
for setidx in range(len(input)): # 0 -> len(input)
if combidx & 1 << setidx: # bitwise operation e.g. 0 & 1 << 0 =>0
temp.append(input[setidx])