Skip to content

Instantly share code, notes, and snippets.

@Taytay
Taytay / regexp_substr2.sql
Created August 2, 2024 12:37
Snowflake enhanced regex_substr. This allows you to use python style regexes in Snowflake.
-- Originally found here: https://github.com/sfc-gh-gpavlik/SnowflakeUDFs/blob/main/RegularExpressions/regexp2.sql
-- Edited to use python and group_num by taytay: https://github.com/taytay/
/********************************************************************************************************
* *
* Snowflake Regular Expression Extensions *
* *
* Copyright (c) 2020 Snowflake Computing Inc. All rights reserved. *
* *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in *
@Taytay
Taytay / uninstall_pip_packages.sh
Created January 8, 2024 15:23
How to uninstall pip-installed packages in conda
conda list | awk '/pypi/ {print $1}' | xargs pip uninstall -y
# Found here: https://stackoverflow.com/a/66012782
params:
# Default params file:
# This actually gets overwritten by hydra at runtime
- params.yaml
stages:
# Note that we set the DVC_STAGE_NAME so it knows it's running in dvc.
train:
cmd:
- DVC_STAGE_NAME=train python scripts/fine_tune/fine_tune_and_evaluate.py --hoist_params_path="trainer_task.train"
// Here is the link to the playground for the following code:
// https://www.typescriptlang.org/play?#code/MYGwhgzhAEAiD2BzaBvAUNT0wDsCWAtmCABKQBi8ArgE4AyApojALzQAuNVDA3BlgAcqAIxB5g0ACZIAcmAIMAXNAic8OZGwBEWvlmhDR46OrzsAFALA15EZQkQAFa7YCUqfvszB4OCPBAGADoQJHMAcgBJbAJsKSQAGmwcSWhoxHh2DgALBggGAxcCO2hw6ABqQptioOlEADViblc9LABfNA7QSBgAYTAs9H1cQmIyCEpaRmZoNk5uVsxDMQlgAbkFZVUadU1oHUWDERWTfAsrapL+9mdL9yGvb19-QJCwqJi4tfYk3FT0zI5PIFC62ZRlSqgmrfRogZqHDpdcBQOBIW62Dz6ZbGOqw7jKHBUAjCBg0WbQAAMhxGRFIFGo9CYrA4XAYnTQ3RR13RxUxgmOxhhTSU0EJxNJ5KpnmSozpEwZ02Z8zZHTQDDF0AA0upUg9MA5tSlyeEDTrwglpddDak2OErWaLaqfH4sgBrHUAWTAAnJeugAG1rUFTSkALr2RLSwM6oL2sPKa6OvjsACeAgK1q9PrmaYY8AAZtB3Sks3w0Kn09AACpUASBCAAHk15OtAD4W9AGAAPdjqyQwa3QAD8AelmqS0siLtwwAYVdzTc93sDodbE-0U9UM7nC-MFbzheLkizrhX7e7vZSMGl+hQpzMynMYGU6nzEsc7hY7dwKegbWH0CONABIMAAbqSaChsBopgaSZYAPTwdAzqqFUthZr6aCIV40YpMGSDWuGqJOEUEAWth+i4ZIsYDIRCYDDyZFYUhbQIUh+6AaRGE5umBZocUpZoMx0AkKSBRmCYMAAFZUKhsm7ECnGXFmwkcTWdZ5E2LY6u2bDNhefYDjqAH+sJ+jjmZWCbuw27zumi4lsumqruRSEbtOOCznZDANoxWZnsJUEgeBNBluW
@Taytay
Taytay / PlagroundLink
Created May 30, 2020 14:50
Riffing on StackOverflow answer
@Taytay
Taytay / t8.shakespeare.txt
Created November 14, 2018 00:27
Test.txt
This file has been truncated, but you can view the full file.
This is the 100th Etext file presented by Project Gutenberg, and
is presented in cooperation with World Library, Inc., from their
Library of the Future and Shakespeare CDROMS. Project Gutenberg
often releases Etexts that are NOT placed in the Public Domain!!
Shakespeare
*This Etext has certain copyright implications you should read!*
<<THIS ELECTRONIC VERSION OF THE COMPLETE WORKS OF WILLIAM
@Taytay
Taytay / install_hub.sh
Created June 26, 2018 19:12
Install latest version of Github's hub on Linux
#!/bin/bash
# Installs latest release of hub on Linux
# Echo, halt on errors, halt on uninitialized ENV variables. (https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/)
set -euxo pipefail
# Hub doesn't have a way to install the latest version using `apt` yet, so I wrote this as a hacky substitute.
# This will be unnecessary when this issue is resolved: https://github.com/github/hub/issues/718#issuecomment-65824284
# Linux options include:
@Taytay
Taytay / heroku_run.sh
Created February 8, 2017 15:14
A more robust version of `heroku run --exit-code`
#!/usr/bin/env expect
# This script requires `expect` to be installed on your system.
# This script runs a remote command on Heroku in detached mode,
# and exits with the same exit code that the remote command does.
# Note that this is superior to `heroku run --exit-code`, since that has a bug that
# often ends the command prematurely, and doesn't always return the correct exit code.
# This also has the advantage of running in detached mode, which will log the output of the command
# to Heroku's logplex. An attached `heroku run` command does not have its output logged.
@Taytay
Taytay / Hubot-YNAB-PullRequest.coffee
Last active August 14, 2019 20:14
Part of our Hubot script that responds to commands in Github Pull Requests - use in conjunction with https://github.com/ynab/hubot-github-adapter
# Description:
# Helper commands for YNAB Pull Requests
#
# Commands:
# hubot rebuild - Rebuilds this branch.
# hubot ketchup|catchup|catch_up|upbase|reverse integrate|reverse_integrate|backmerge|back_merge - Merges the target branch back into this pull request branch.
TextMessage = require('hubot').TextMessage
GitHubApi = require("github"); # https://github.com/mikedeboer/node-github
@Taytay
Taytay / rsvp.d.ts
Last active November 18, 2016 21:52
Type definitions for RSVP. Still needs unit tests.
// Type definitions for RSVP
// Project: github.com/tildeio/rsvp.js
// Definitions by: Taylor Brown <https://github.com/Taytay>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
// Some of this file was taken from the type definitions for es6-promise https://github.com/borisyankov/DefinitelyTyped/blob/master/es6-promise/es6-promise.d.ts
// Credit for that file goes to: François de Campredon <https://github.com/fdecampredon/>
// Some of this file was taken from the type definitions for Q : https://github.com/borisyankov/DefinitelyTyped/blob/master/q/Q.d.ts
// Credit for that file goes to: Barrie Nemetchek <https://github.com/bnemetchek>, Andrew Gaspar <https://github.com/AndrewGaspar/>, John Reilly <https://github.com/johnnyreilly>