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
| // Run this with: | |
| // jsonnet ./dd_prom_instance.jsonnet | |
| local app = { name: 'examplesvc' }; | |
| local baseAnnotations = { | |
| deployment+: { | |
| spec: { | |
| template: { | |
| spec: { | |
| containers_:: { |
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
| # in response to this conversation: https://news.ycombinator.com/item?id=45417191 | |
| from pprint import pprint | |
| # group_by here is ultimately used to create a tree structure (nested dictionaries) of the form | |
| # keys[0] -> keys[1] -> ... -> keys[n] -> getid(object). We use it here to construct a tree data | |
| # structure that's conceptually equal to a database index (not exactly the same, but shows the same | |
| # properties we care about). | |
| def group_by(objects, keys, getid=None): | |
| if getid is None: | |
| getid = lambda x: x['id'] | |
| result = {} |
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
| # Paste this snippet into your .bashrc to help you learn `git switch`. | |
| # | |
| # Turn on the extdebug mode so that our `scold_git_checkout` can prevent | |
| # us from running git-checkout by exiting 1; forcing us to re-learn our | |
| # muscle memory. | |
| # If we *really* need to use git checkout for something, we can do that | |
| # by using the full path to the git executable e.g.: | |
| # /usr/bin/git checkout # isn't caught by our scolding | |
| shopt -s extdebug |
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
| // copy paste into the console on a page like | |
| (()=>{ | |
| const shrinkSpaces = (str) => { return str.replace(/\s+/g, ' '); }; | |
| let params = new URL(document.location.toString()).searchParams; | |
| console.log(`Start Index: ${params.get('startIndex')}`) | |
| const splitOn = ['Order placed', 'Total', 'Ship to', 'Order #', 'View order details', 'View invoice']; | |
| const regex = new RegExp(splitOn.join("|"), "g"); | |
| const rows = document.querySelectorAll('.order-header'); | |
| let csv = ""; | |
| rows.forEach((row, idx) => { |
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
| #!/bin/bash | |
| # A script to re-run your latest failing workflow for a given Github project | |
| # Examples: | |
| # | |
| # circleci-retry-failing-workflow.bash orgservice | |
| # | |
| # circleci-retry-failing-workflow.bash lichee | |
| if [ $# -eq 0 ]; then |
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
| // A fun challenge; make it print your name, instead of mine : ) | |
| ((G, O)=>O((D, __, LUCK)=>()=>{ | |
| console.log("from your friend: "+D(__)(LUCK)); | |
| })())("HAVE FUN", | |
| (w) => {return w( | |
| ((window) => ((_)=>_(_))( (($)=>window( ((console)=>$($)(console)))))), | |
| ((N) => ((L)=> 6 ^ (~~L) ? String.fromCharCode(95-(31 & 924798803 >> 5 * L))+N((~~L)+1) : "\n")), | |
| undefined)}); |
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
| // Compile with: | |
| // gcc ./cmdinfo.c -lm -o cmdinfo | |
| #include <stdio.h> /* printf(), fprintf() */ | |
| #include <string.h> /* strcmp() */ | |
| #include <math.h> /* log10(), ceil() */ | |
| // fwd decl to cease warnings | |
| int print_arguments(FILE* outf, int argc, char *const *argv); | |
| int xxdline(int lineno, char* input, int inputlen, char* outbuf); |
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
| package main | |
| import ( | |
| "fmt" | |
| "go/ast" | |
| "go/parser" | |
| "go/token" | |
| "io" | |
| "io/fs" | |
| "log" |
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
| #!/bin/bash | |
| # Originally based on ag-replace.sh: | |
| # https://gist.github.com/adamryman/1de22e36a14c29da2f41c8512cb86b6d | |
| usage() { | |
| echo "Usage: $(basename $0) \"THIS\" \"THAT\""; | |
| echo "Replaces all instances of THIS with THAT in all files which contain THIS." | |
| echo "Additionally, prints each file as that file is modified" | |
| exit 1; |
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
| #!/bin/bash | |
| usage() { | |
| echo "Usage: $(basename $0) \"THIS\" \"THAT\""; | |
| echo "Replaces all instances of THIS with THAT in all files which contain THIS." | |
| echo "Additionally, prints each file as that file is modified" | |
| exit 1; | |
| } | |
NewerOlder