- let's try outlines
- here's something that i'd love to ensure gets wrapped oh wow, v cool
- how about this?
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
| # this is probably less elegant than just using the API to do this | |
| # https://docs.looker.com/reference/api-and-integration/api-reference/v3.1/content#validate_content | |
| # largely copied from https://stackoverflow.com/a/44275458 | |
| import csv | |
| from bs4 import BeautifulSoup | |
| # find the table where all the data lives via 'inspect element' or whatever | |
| # and save it into a file that we read here. |
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
| dot -Kfdp -Nfontname=Courier -Nfontsize=10 -Efontname=Courier -Efontsize=10 -T{fmt} {dot_filepath} -o {output_filepath} |
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: | |
| base: orders | |
| joins: | |
| - name: items | |
| type: inner | |
| on: items.order_id = orders.id | |
| - name: products | |
| type: inner | |
| on: products.id = items.product_id | |
| - name: shipments |
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
| """ | |
| TruffleHog Results Parsing | |
| Designed to operate on the output of trufflehog's json output: | |
| $ trufflehog --json <my_repo> > my_output.json | |
| Expects a `trufflehog_output.json` file, and a `trufflehog_whitelist.yml` file. | |
| Whitelist config file should look like: |
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 random | |
| import time | |
| import multiprocessing as mp | |
| def sleep_random(n): | |
| sleep_seconds = random.randint(0, 3) | |
| print(f'sleeping for {sleep_seconds} seconds') | |
| # randomly fail | |
| x = 5 / sleep_seconds |
How to squash commits, for when you forget:
• ~/src $$$ mkdir git-stuff
• ~/src $$$ cd git-stuff/
• ~/src/git-stuff $$$ git init
Initialized empty Git repository in /Users/ryan.tuck/src/git-stuff/.git/
• ~/src/git-stuff $$$ git status
On branch master
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 json | |
| import random | |
| def _gen_ids(b,e): | |
| return f'generate_series({b}, {e})::bigint' | |
| def _gen_float(): | |
| return 'random()' |
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 csv | |
| import os | |
| source_filename = 'all.csv' | |
| records_per_file = 1000 | |
| target_file_prefix = 'target/split' | |
| with open(source_filename, 'r') as source: | |
| reader = csv.reader(source) |