Skip to content

Instantly share code, notes, and snippets.

View tiffehr's full-sized avatar
🎯
Focusing

Tiff Fehr tiffehr

🎯
Focusing
View GitHub Profile
@tmcw
tmcw / optimization.md
Last active February 14, 2021 14:38
Optimization

Optimization

Correctly prioritizing and targeting performance problems and optimization opportunities is one of the hardest things to master in programming. There are a lot of ways to do it wrong: by prematurely optimizing non-bottlenecks, or preferring fast solutions to clear solutions, or measuring problems incorrectly.

I'll try to summarize what I've learned about doing this right.

First, don't optimize until there's an issue. And issues should be defined as application issues: performance problems that are either detectable by the users (lag) or endanger the platform – i.e. problems that cause downtime, like out-of-memory issues. Until there's an issue, don't think about peformance at all: just solve the problem at hand, which is "creating value for the end-user," or some less-corporate translation of the same.

Second, only optimize with instruments. By instruments, I mean technology that lets you decipher which sub-part of the stack is the bottleneck. Let's say you see slowness around fet

@newsroomdev
newsroomdev / iowa-2020-pagespeeds.md
Last active March 4, 2020 02:52
Iowa 2020 Caucus Results Pagespeed Comparison

Iowa 2020 Caucus Results Pagespeed Comparison

It’s election season again y’all! That means a ton of engineers at news orgs are spending sleepless nights building different reader experiences with various tech stacks. In years past I’ve informally compared all the different approaches because I find it educational. One big reason, the faster your page is, the easier it is for folks to enjoy it regardless of their internet connection speeds.

Methodology

Links were gathered via Twitter, primarily using a thread by Tiff Fehr. Basic criteria are the page has to feature updating vote and/or delegate counts. Scores were tallied after running PageSpeed Insights at least three times to establish an average. Additionally, AMP pages were used over non-AMP page versions with the main assumption being that readers are coming to the page on mobile either via social media or after searching for election results. I was also really curious to see how AMP performed when it came to interacti

Got Retweets?

Even though Twitter's statuses/retweets API endpoint is limited to the last 100 retweets it is possible to use the search/tweets endpoint to search for the retweets using the text of the tweet. Caveat: This is only possible for tweets that have happened in the last 7 days, which is furthest back Twitter allow you to search for tweets in.

For example here is how you can get the retweets for this tweet and analyze the users in a spreadsheet.

@ndarville
ndarville / README.md
Last active September 21, 2023 21:34
How to export and rehost your Tumblr site

How to export and rehost your Tumblr site

(Update: Version 3.2.0 of Jekyll looks like it's breaking a few things, so I've changed the guide to make you specifically install the version I was using, 3.1.3. I believe this is the issue: jekyll/jekyll#5145.)

You will be using jekyll-import to export your Tumblr site, Jekyll to (re)create it, and Surge to rehost it.

Update: You can also use Tumblr's native export feature in your blogs' individual settings. But rehosting that might be tricky. Read my comments below this post for how that works.

Setup and installation

Instructions

These instructions will help you better analyze the IRS 990 public dataset. The first thing you'll want to do is to read through the documentation over at Amazon. There's a ~108MB index file called index.json.gz that contains metadata describing the entire corpus.

To download the index.json.gz metadata file, you'll want to issue the following command: curl https://s3.amazonaws.com/irs-form-990/index.json.gz. Once you've downloaded the index.json.gz file, you can extract its contents with the following command: gunzip index.json.gz. To take a peek at the extracted contents, use the following command: head index.json.

Looking at the index.json file, you'll notice that it contains a json structure represented as a string. It contains an array of json objects that look like the following:

{"EIN": "721221647", "SubmittedOn": "2016-02-05", "TaxPeriod": "201412", "DLN": "93493309001115", "LastUpdated": "2016-03-21T17:2
@bastman
bastman / docker-cleanup-resources.md
Created March 31, 2016 05:55
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@richardsalex
richardsalex / nicar16_handson_info.md
Created March 3, 2016 19:59
NICAR16 Hands-on Teacher Information

#NICAR16 Hands-on Teacher Information

First, thank you so much for sharing your time and expertise. This conference wouldn't be possible without your commitment to teach. We truly appreciate your help!

Hands-on rooms

Unless specifically noted as having registration required, all hands-on classes are first-come, first-served. Each hands-on room is equipped with 24 student computers (except for Mattie Silks, which has 30) and one for the presenter. IRE staff will limit attendance if the room becomes too crowded; this is at the hotel's request to comply with local fire code. For the same reason, the rooms will already be set with the maximum number of chairs allowed.

Please attend a hands-on meeting in Denver

@phobson
phobson / wind_rose.ipynb
Last active March 3, 2024 07:17
Making a wind rose in pandas/matplotlib
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jeremyjbowers
jeremyjbowers / wines.md
Last active August 29, 2015 14:15
My favorite wines, in no particular order
  • Alberto Tedeschi, Pignoletto, "Spungola Bellaria", White, Emilia-Romagna, Italy
  • Fondo Antico, Grillo, "Baccadoro", Dessert, Sicily, Italy
  • Jeff Sowells, Semillon mix, Topaz "DLX", Dessert, Napa, United States
  • Arger-Martucchi, Semillon mix, "Dulcinea", Dessert, Napa, United States
  • COS, Insolia/Grecanico, "Rami", White, Sicily, Italy
  • Arianna Occhipinti, Nero d'Avola/Frappato, "SP68 Rosso", Red, Sicily, Italy
  • Arianna Occhipinti, Albanello/Zibibo, "SP68 Bianco", White, Sicily, Italy
  • Giulio Armani, Malvasia di Candia/Ortrugo/Marsanne, "Dinavolino", Orange, Emilia-Romagna, Italy
  • Giulio Armani, Malvasia di Candia/Ortrugo/Marsanne, "Dinavolo", Orange, Emilia-Romagna, Italy
  • Giulio Armani, Malvasia di Candia/Ortrugo/Marsanne, "Dinavolo SEI", Orange, Emilia-Romagna, Italy
@Kartones
Kartones / postgres-cheatsheet.md
Last active May 3, 2024 20:51
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)