Skip to content

Instantly share code, notes, and snippets.

@mostlygeek
mostlygeek / gist:132fe3a2c2c127ec39c8d4ed667118e0
Created April 24, 2017 20:30
socorro product_versions schema
# Pastebin 61oIMnsy
breakpad=> \d product_versions
Table "public.product_versions"
Column | Type | Modifiers
--------------------+-----------------+--------------------------------------------------------------
product_version_id | integer | not null default nextval('product_version_id_seq'::regclass)
product_name | citext | not null
major_version | major_version | not null
release_version | citext | not null
version_string | citext | not null
@mostlygeek
mostlygeek / balrog-info.json
Created April 24, 2017 20:09
balrog info json
{
"appVersion": "53.0",
"detailsUrl": "https:\/\/www.mozilla.org\/%LOCALE%\/firefox\/53.0\/releasenotes\/",
"displayVersion": "53.0",
"fileUrls": {
"*": {
"completes": {
"*": "http:\/\/download.mozilla.org\/?product=firefox-53.0-complete&os=%OS_BOUNCER%&lang=%LOCALE%"
@mostlygeek
mostlygeek / latency-buckets-pro.awk
Last active March 10, 2017 21:08
sync log awk script tools
#!/usr/bin/awk -f
BEGIN {
idx[0] = 5
idx[1] = 10
idx[2] = 25
idx[3] = 50
idx[4] = 100
idx[5] = 500
@mostlygeek
mostlygeek / sync-logs-to-sqlite.sh
Created July 25, 2016 20:43
Converts sync nginx logs to sqlite3 file
#!/bin/sh
# Extracts and converts a sync storage log file into an sqlite3
# database to make it easier to extract information
if [ ! -e $1 ]; then
echo "Usage $0 <gzip sync log file>"
exit 1
fi
@mostlygeek
mostlygeek / docker-pull-verify-push.sh
Created July 15, 2016 16:14
shell script for verifying docker images with the digest hash
#!/usr/bin/env bash
# The docker registry has the canonical sha sum for verifying the
# image. The only way to get this (as of this coding) is the output from
# docker push/pull jobs. :|
#
# This script pulls the image and remembers the digest. Then that hash
# value is searched for in the build logs in circle or taskcluster
# if the sha256 hash value is found, the image is considered to be OK
@mostlygeek
mostlygeek / example.md
Created July 5, 2016 19:23
Getting cache hit rate from nginx

assumes that $upstream_cache_status is at the end of the log line:

tail -n 50000 access.log | \
  grep -v heartbeat | \
  awk 'BEGIN {C=0;T=0; } {if ( $NF == "HIT" || $NF=="EXPIRED" ) { C = C + 1 }; T=T+1} END { print C,T,C/T*100 }'

Output:

@mostlygeek
mostlygeek / test-cdn.sh
Created January 28, 2016 18:13
Test CDN before migrating the actual DNS
#!/bin/sh
#
# <3 curl.
#
# Pages to check on MDN to get resource URIs
URLS='
https://developer.mozilla.org/en-US/
https://developer.mozilla.org/en-US/docs/Web/HTML
@mostlygeek
mostlygeek / requirements.txt
Last active November 27, 2018 19:59
Interview Question - Build a Thumbnail Generator
Describe how you would build this thumbnail web service:
- Accept a JPEG via an anonymous HTTP request from the client
- Create a scaled down, 25% thumbnail of it
- Return a text/plain response, with URLs to the original and thumbnail, i.e:
https://i.mozilla.org/abc123.original.jpeg
https://i.mozilla.org/abc123.thumb.jpeg
- Images (original + thumbnails) automatically deleted after 7 days
@mostlygeek
mostlygeek / build.txt
Created December 29, 2015 00:02
Build this...
- Create a web service that takes an image from the user (JPEG) and creates a scaled down to 25% thumbnail (JPEG).
- Users are anonymous, no need to log in
- A URL is automatically created for the user's uploaded images, https://i.mozilla.org/abc123.original.jpeg
- A URL is automatically created for the thumb nail, https://i.mozilla.org/abc123.thumb.jpeg
- Images (original + thumbnails) automatically deleted after 7 days
Requirements:
- Must be hosted in AWS and use AWS technologies
@mostlygeek
mostlygeek / vim.markdown
Created November 27, 2015 18:29 — forked from socketwiz/vim.markdown
Vim cheat sheet

##motions

motion description
h Count characters left
l Count characters right
^ To the first character of the line
$ To the last character of the line
f<char> To the counth character occurrence to the right. F<char> to the counth character occurrence to the left
t<char> To 1 character just before the counth character occurrence to the right
T<char> To 1 character just before the counth character occurrence to the left