layout | author | title | revision | version | description |
---|---|---|---|---|---|
default |
mattmc3 |
Modern SQL Style Guide |
2019-01-17 |
1.0.1 |
A guide to writing clean, clear, and consistent SQL. |
This file contains 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
# Connect to GCP Cloud Build docker (or docker compose) container from outside of docker from the subsequent step | |
# | |
# (For some reason, the below code requires "dockerize - wait" to work) | |
steps: | |
- name: 'gcr.io/cloud-builders/docker' | |
args: ['run', '--name', 'ping_svc', '--network', 'cloudbuild', '-d', 'jonmorehouse/ping-pong'] | |
- name: 'jwilder/dockerize:0.6.1' | |
args: ['dockerize', '-timeout=60s', '-wait=http://ping_svc:8080'] | |
- name: 'gcr.io/cloud-builders/curl' |
This file contains 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
# using: | |
# - git filter-branch OR | |
# - git filter-repo | |
# extract folder into a new repo | |
git clone [email protected]:__ORG__/__PROJECT__.git __LOCAL_ALIAS_DIR__ | |
cd __LOCAL_ALIAS_DIR__ | |
git co -b main |
This file contains 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
# brew install jsmin | |
cat file-with-comments.jsonc | jsmin | jq 'keys' |
This file contains 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
PROCESS_PHRASE="*:8080 (LISTEN)" | |
PROCESS_LINE=`lsof -Pn | grep "$PROCESS_PHRASE"` | |
if [[ -n $PROCESS_LINE ]]; then | |
PROCESS_ID=`awk '{print $2}' <<< $PROCESS_LINE` | |
echo "Killing process id=$PROCESS_ID ('$PROCESS_LINE')" | |
else | |
echo "No matching process found for '$PROCESS_PHRASE'" | |
fi |
Prioritize Homebrew's python3 over default MacOS python2:
export PATH="/usr/local/opt/python/libexec/bin:$PATH"
Install python3 with Homebrew:
brew install python
This file contains 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
''' | |
Based on https://gist.github.com/enjalot/2904124 (in Python 2) -> quick-migrated to Python 3 | |
Usage: python server-cors | |
''' | |
import http.server as httpserver | |
class CORSHTTPRequestHandler(httpserver.SimpleHTTPRequestHandler): | |
def send_head(self): | |
"""Common code for GET and HEAD commands. |
This file contains 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
echo '{"yo":"boo", "so":"no"}' | python -m json.tool | |
{ | |
"so": "no", | |
"yo": "boo" | |
} |
This file contains 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
def loadResource(filename: String) = { | |
val source = scala.io.Source.fromURL(getClass.getResource(filename)) | |
try source.mkString finally source.close() | |
} |
NewerOlder