Skip to content

Instantly share code, notes, and snippets.

*.yml.enc diff=encrypted
@schacon
schacon / gist:b6ad79b4974eb4a55e330502fde1095b
Created February 24, 2025 15:58
trace packet for a simple git clone
❯ GIT_TRACE_PACKET=1 git clone https://github.com/schacon/blink
Cloning into 'blink'...
16:58:04.532660 pkt-line.c:85 packet: git< # service=git-upload-pack
16:58:04.533707 pkt-line.c:85 packet: git< 0000
16:58:04.533715 pkt-line.c:85 packet: git< version 2
16:58:04.533731 pkt-line.c:85 packet: git< agent=git/github-d6c9584635a2
16:58:04.533737 pkt-line.c:85 packet: git< ls-refs=unborn
16:58:04.533742 pkt-line.c:85 packet: git< fetch=shallow wait-for-done filter
16:58:04.533751 pkt-line.c:85 packet: git< server-option
16:58:04.533756 pkt-line.c:85 packet: git< object-format=sha1
@schacon
schacon / gitconfig.ini
Created February 20, 2025 19:30
my gitconfig
[column]
ui = auto
[branch]
sort = -committerdate
[tag]
sort = version:refname
[init]
defaultBranch = main
[diff]
algorithm = histogram
@schacon
schacon / better-git-branch.sh
Created January 13, 2024 18:41
Better Git Branch output
#!/bin/bash
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
NO_COLOR='\033[0m'
BLUE='\033[0;34m'
YELLOW='\033[0;33m'
NO_COLOR='\033[0m'
@schacon
schacon / git-related-files.rb
Last active February 17, 2025 10:04
git-related-files.sh
@schacon
schacon / column_names.sql
Last active January 8, 2024 01:33
getting a list of table column names in BigQuery
// first, grab a list of the field names in a table
SELECT STRING_AGG(column_name, ", \n" ORDER BY ordinal_position)
FROM [project_name].[dataset_name].INFORMATION_SCHEMA.COLUMNS
where table_name = 'blah'
group by table_name
@schacon
schacon / docker-compose.yml
Created August 15, 2021 19:15
Docker Compose file for ruby, postgres and redis
version: '3'
services:
app:
build:
context: ..
dockerfile: .devcontainer/Dockerfile
args:
VARIANT: 2.6
NODE_VERSION: "lts/*"
volumes:
@schacon
schacon / cohort.sql
Last active November 3, 2020 23:38
Cohort Month Base Values for BigQuery
select month, months_out from (
select month,
GENERATE_ARRAY(0, DATE_DIFF(CURRENT_DATE(), month, MONTH)) as months,
from UNNEST(
(select
GENERATE_DATE_ARRAY(CAST([STARTING_DATE] AS DATE), CAST(max(date_field) AS DATE),
INTERVAL 1 MONTH) as date
from [SOME_TABLE_WITH_A_DATE_FIELD])
) as month
) CROSS JOIN UNNEST(months) as months_out

Keybase proof

I hereby claim:

  • I am schacon on github.
  • I am scottchacon (https://keybase.io/scottchacon) on keybase.
  • I have a public key ASAcTJsFnTw59Ncpg1Bax0VQ1yH1B3N2MQaDHsadrT95aAo

To claim this, I am signing this object:

@schacon
schacon / gist:793c8fdea738fd3d04a7
Created December 18, 2014 16:25
crush and resize book images
#! /usr/bin/env ruby
require 'rubygems'
require 'oily_png'
Dir.glob("book/**/*.png").each do |file|
puts file
image = ChunkyPNG::Image.from_file(file)
p image.width
p image.height
if image.width > 800 || image.height > 800