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
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Dependency Graph Visualizer</title> | |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/cytoscape/3.26.0/cytoscape.min.js"></script> | |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/dagre/0.8.5/dagre.min.js"></script> | |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/cytoscape-dagre/2.5.0/cytoscape-dagre.min.js"></script> | |
| <style> |
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 -*- | |
| """Format SQL query using sqlglot library.""" | |
| import argparse | |
| import sys | |
| import typing as t | |
| import sqlglot | |
| import sqlglot.expressions as exp |
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 -*- | |
| import sqlparse | |
| def format_sql(sql): | |
| """Format SQL query using sqlparse library.""" | |
| return sqlparse.format( | |
| sql, | |
| reindent=True, |
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 pandas as pd | |
| from typing import Any, Optional | |
| def discrete_median(series: pd.Series) -> Optional[Any]: | |
| """Compute the discrete median for any sortable Series (numeric, string, datetime, categorical). | |
| - For numbers, returns the middle value (without interpolation). | |
| - For strings, returns the lexicographically middle element. | |
| - For datetime, returns the middle timestamp. | |
| - For categorical, uses category order if available. |
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 | |
| import importlib | |
| import re | |
| import os.path | |
| import site | |
| import sys | |
| from typing import List, Optional | |
| def print_usage() -> None: |
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/python3 | |
| """ | |
| Note: | |
| * This snippet is copied from https://awsiammedia.s3.amazonaws.com/public/sample/SAMLAPICLIADFS/0192721658_1562696767_blogversion_samlapi_formauth_python3.py | |
| * It's part of this AWS blog: https://aws.amazon.com/blogs/security/how-to-implement-a-general-solution-for-federated-apicli-access-using-saml-2-0/ | |
| * saml2aws is based on this blog, but saml2aws is implemented in Golang(see https://github.com/Versent/saml2aws/blob/11b0c262d857b582e5a62a7b4aaa5314fcdbcbd2/README.md?plain=1#L9C1-L10C1). | |
| Summary: |
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
| from collections import namedtuple | |
| def convert(dictionary): | |
| return namedtuple('GenericDict', dictionary.keys())(**dictionary) | |
| """ | |
| >>> d = dictionary(a=1, b='b', c=[3]) | |
| >>> named = convert(d) | |
| >>> named.a == d.a | |
| True | |
| >>> named.b == d.b |
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
| # Copyright (c) 2016-2018 Ming Qin (覃明) <https://github.com/QinMing> | |
| # Open source under MIT LICENSE. | |
| lazy_load() { | |
| # Act as a stub to another shell function/command. When first run, it will load the actual function/command then execute it. | |
| # E.g. This made my zsh load 0.8 seconds faster by loading `nvm` when "nvm", "npm" or "node" is used for the first time | |
| # $1: space separated list of alias to release after the first load | |
| # $2: file to source | |
| # $3: name of the command to run after it's loaded | |
| # $4+: argv to be passed to $3 |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000NewerOlder