This file contains hidden or 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
| dict_inv = dict([(j, i) for i, j in original_dict.items()]) |
This file contains hidden or 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
| LOAD DATA | |
| LOCAL INFILE '~/your_path/foo.csv' | |
| INTO TABLE your_table | |
| CHARACTER SET 'utf8mb4' | |
| FIELDS TERMINATED BY ',' | |
| ENCLOSED BY '"' | |
| LINES TERMINATED BY '\n' | |
| IGNORE 1 ROWS; | |
| /* |
This file contains hidden or 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
| #!/usr/bin/env python | |
| # coding: utf-8 | |
| from pathlib import Path | |
| import pandas as pd | |
| tbl_lft = Path(input('Left table? >> ')) | |
| tbl_rgt = input('Right table? >> ') | |
| df_lft = pd.read_csv(tbl_lft) |
This file contains hidden or 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 os | |
| import time | |
| from pathlib import Path | |
| from urllib.parse import urljoin, urlsplit | |
| import pandas as pd | |
| import requests | |
| from bs4 import BeautifulSoup | |
This file contains hidden or 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
| -- https://stackoverflow.com/questions/1517635/save-pl-pgsql-output-from-postgresql-to-a-csv-file/1517692#1517692 | |
| -- This approach runs entirely on the remote server | |
| Copy (Select * From foo) To '/tmp/test.csv' With CSV DELIMITER ',' HEADER; | |
| -- The other approach is to do the file handling on the client side, i.e. in your application or script. | |
| \copy (Select * From foo) To '/tmp/test.csv' With CSV | |
| -- Import from csv |
This file contains hidden or 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
| #!/usr/bin/env zsh | |
| # Cf. https://github.com/navdeep-G/samplemod | |
| read "?New project name? >> " new_pj | |
| cp -r $HOME/PycharmProjects/samplemod-master ./$new_pj/ | |
| mkdir ./$new_pj/$new_pj/ | |
| rm -r ./$new_pj/sample/ |
This file contains hidden or 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
| #/usr/bin/env python3 | |
| def str_normalizer(raw_str): | |
| """Blah""" | |
| circ_nums = { | |
| '=1=': '①', '=2=': '②', '=3=': '③', '=4=': '④', '=5=': '⑤', | |
| '=6=': '⑥', '=7=': '⑦', '=8=': '⑧', '=9=': '⑨', '=10=': '⑩' | |
| } | |
| norm_str = re.sub(r'\N{VT}', '', raw_str) # Matches a vertical tab(VT). | |
| norm_str = re.sub(r'([①②③④⑤⑥⑦⑧⑨⑩])', r'=\g<1>=', norm_str) # maru -> arabic |
This file contains hidden or 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
| #!/bin/zsh | |
| # Author: Eiichi YAMAMOTO | |
| # Created: 20th August 2021 | |
| # Last Modified: 20th August 2021 | |
| # Description: | |
| # Move a file or a directory to the Trash | |
| mv $1 ~/.Trash/ |
This file contains hidden or 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
| #!/usr/bin/env zsh | |
| # Google Search from Command Line | |
| # Usage: ggler <query> | |
| display_usage() { | |
| echo "Usage: ggler <query>" | |
| echo "Example: ggler hello world" | |
| } |
This file contains hidden or 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
| #!/usr/bin/env zsh | |
| header=" | |
| .. You can adapt this file completely to your liking, but it should at least | |
| contain the root \`toctree\` directive. | |
| =============================== | |
| $PWD | |
| =============================== |