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
// This is a workaround for an outstanding issue in Blueprint as of 5/8/23. | |
// Issue is here: https://github.com/palantir/blueprint/issues/6051 | |
// | |
// Basically, there's an issue where Sass-loader in webpack can't use Sass' new API for creating custom functions in Sass. | |
// Blueprint.js needs to register a custom function to render some svg icons. | |
// However, I guess the build process in Blueprint doesn't actually use webpack at all (lucky them), so we get to modify Blueprint's nice svg loader code to work with the old API. | |
// In our webpack.config.mjs file, we import legacySassSvgInlinerFactory and use it instead of sassSvgInlinerFactory. | |
// | |
// Taken from https://github.com/palantir/blueprint/blob/develop/packages/node-build-scripts/src/svg/svgOptimizer.mjs |
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
#!/bin/bash | |
pt-online-schema-change \ | |
--execute \ | |
--progress time,1 \ | |
--print \ | |
--recursion-method=none \ | |
-h my_host \ | |
-u root \ | |
--ask-pass \ |
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
#!/bin/bash | |
# Deletes data in the given table. | |
# This takes the strategy of deleting based on | |
# some indexed key, possibly the primary key. | |
# It will repeatedly delete the first 1000 | |
# records found up to the maximim $MAXVAL. | |
# This seems to have OK performance when working | |
# against a small Aurora instance. | |
# It deletes around 100,000 records every minute. |
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
import signal | |
from threading import Thread | |
import time | |
class MyThread(Thread): | |
def __init__(self): | |
super().__init__() | |
self._stopped = False | |
def run(self): |
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
#!/bin/bash | |
# Example of how to use Percona's online schema changer tool. | |
# Tips! | |
# Don't put any semicolons in your schema commmands! | |
# Separate schema commands by commas; i.e., ADD COLUMN y_id bigint NULL, ADD CONSTRAINT y_fk FOREIGN KEY (y_id) REFERENCES y(y_id)" | |
# When testing, remove the --execute flag! | |
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
from contextlib import contextmanager | |
import MySQLdb | |
import MySQLdb.cursors | |
import logging | |
from django.conf import settings | |
log = logging.getLogger(__name__) |
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
import json | |
import typing | |
from datetime import datetime | |
import boto3 | |
from botocore.exceptions import ClientError | |
def create_or_stream_to_log( | |
aws_cli_logs, |
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
-- It's often super useful to generate a timseries-based histogram | |
-- of records counts over a period time, grouped into arbitrary | |
-- timedelta chunks. | |
-- Imagine we have a table like this. | |
-- It has a datetime field, dt, | |
-- some special key somekey (imagine its a foreign key or | |
-- some other useful value that you want to filter by), | |
-- and an index on (somekey, dt) | |
CREATE TABLE `foo` ( |
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
Favicons | |
======== | |
They're a huge pain in the ass. | |
Use this website: https://realfavicongenerator.net/ | |
For more, read this: https://stackoverflow.com/questions/18301745/how-to-set-up-a-favicon/26768184 |
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
# Pipes data from one MySQL database into another. | |
# Tested with AWS Aurora MySQL (using a 5.7-compatible version of MySQL) to AWS RDS MySQL 8.0. | |
# Probably only suitable for small (<1 TB) databases. | |
# It takes a long time, and if it breaks halfway through you just have to start over from scratch. | |
# Probably not suitable for production without a bunch more work. | |
export $SOURCE_USER= | |
export $SOURCE_HOST= | |
export $SOURCE_PW= | |
# Needs to be a comma-separated list of tables, i.e., user,sale,item |
NewerOlder