Skip to content

Instantly share code, notes, and snippets.

@schacon
schacon / gist:1
Created July 15, 2008 18:17
the meaning of gist
This is gist.
There are many like it, but this one is mine.
It is my life.
I must master it as I must master my life.
Without me gist is useless.
Without gist, I am useless.
@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-http-proto.txt
Created July 26, 2013 22:16
Git HTTP transport protocol documentation
HTTP transfer protocols
=======================
Git supports two HTTP based transfer protocols. A "dumb" protocol
which requires only a standard HTTP server on the server end of the
connection, and a "smart" protocol which requires a Git aware CGI
(or server module). This document describes both protocols.
As a design feature smart clients can automatically upgrade "dumb"
protocol URLs to smart URLs. This permits all users to have the
@schacon
schacon / git-related-files.rb
Last active March 26, 2024 05:15
git-related-files.sh
@schacon
schacon / plumbing.md
Created August 18, 2011 04:51
plumbing cheat sheet

the plumbing commands

  • rev-parse [something]

    • show the SHA of any weird git phrase
  • hash-object -w [file]

    • take any file or stdin and return a blob sha
  • ls-tree (-r) [sha]

  • show the entries of a git tree in the db

@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 / gist:942899
Created April 26, 2011 19:19
delete all remote branches that have already been merged into master
$ git branch -r --merged |
grep origin |
grep -v '>' |
grep -v master |
xargs -L1 |
awk '{split($0,a,"/"); print a[2]}' |
xargs git push origin --delete
@schacon
schacon / FUGPL.txt
Created September 25, 2008 18:49
the anti-gpl license
The FUGPL License
===================
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software with only one restriction. No part of
it may be included in software projects that are solely distributed under
strong copyleft restricted licenses. This license is *NOT* GPL compatible,
and that is it's only restriction.
@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:
dfg