Skip to content

Instantly share code, notes, and snippets.

@Shawn1224
Shawn1224 / backup_tabls_pg.py
Created April 2, 2019 07:06
Backup specific tables for pg
COMMAND_PRE = "pg_dump --column-inserts -a"
def backup(host_name, database_name, user_name, port, database_password, tables, file_dir="."):
"""backup specific tables for pg
Ref: http://wzktravel.github.io/2016/08/23/How-to-pass-in-password-to-pg-dump/
export shell demo:
pg_dump --column-inserts -a -h {0} -d {1} -U {2} -p 5432 -t zones_seq -t table_2 > /tmp/zones_seq.sql
export file:
filename format:
@Shawn1224
Shawn1224 / cloudSettings
Last active September 18, 2019 08:15
Designer PDF Viewer
{"lastUpload":"2019-09-18T08:15:12.711Z","extensionVersion":"v3.4.2"}
@Shawn1224
Shawn1224 / day-8.md
Last active July 26, 2019 10:32
Practice > Tutorials > 30 Days of Code > Day 8: Dictionaries and Maps

Solution of Day 8: Dictionaries and Maps

👎💩 What did i fuck up?

As the task describe, you may confidently wrote down some code like below what I done at first:

N = int(input())
d = dict()
@Shawn1224
Shawn1224 / queues_and_stacks.md
Created August 22, 2019 08:05
Some Intros About Queues and Stacks
@Shawn1224
Shawn1224 / install-mysqlclient-on-macos.md
Last active August 23, 2021 13:41
Install mysqlclient(Python package) on macOS

Try this first.

brew install mysql-connector-c
sudo pip install MySQL-python

If fail then try below.

brew unlink mysql
brew install mysql-connector-c
@Shawn1224
Shawn1224 / scroll.py
Created November 28, 2019 11:13 — forked from hmldd/scroll.py
Example of Elasticsearch scrolling using Python client
# coding:utf-8
from elasticsearch import Elasticsearch
import json
# Define config
host = "127.0.0.1"
port = 9200
timeout = 1000
index = "index"