Skip to content

Instantly share code, notes, and snippets.

View cbandy's full-sized avatar

Chris Bandy cbandy

View GitHub Profile
@cbandy
cbandy / features.md
Last active June 28, 2019 06:17
DFW PostgreSQL Meetup, July 3
parallel kubectl -n apps get -w --show-kind -L app,tag -- deploy rs pod | TZ=UTC ts

Keybase proof

I hereby claim:

  • I am cbandy on github.
  • I am cbandy (https://keybase.io/cbandy) on keybase.
  • I have a public key ASAzP7WTmpf0R47G2utxnt0tmeJT4CVYC0H3fLBFspnfwgo

To claim this, I am signing this object:

-- https://github.com/dimitri/pgloader/blob/master/src/sources/mysql/sql/list-all-columns.sql
-- mysql 5.0
+---------------------+---------------+------------------------+----------------+----------------+---------------------+----------------+-------------+-------+
| table_name | table_comment | column_name | column_comment | data_type | column_type | column_default | is_nullable | extra |
+---------------------+---------------+------------------------+----------------+----------------+---------------------+----------------+-------------+-------+
| corporate_contracts | | contract_value | | float unsigned | float unsigned | NULL | NO | |
+---------------------+---------------+------------------------+----------------+----------------+---------------------+----------------+-------------+-------+
-- mysql 5.7
@cbandy
cbandy / .gcloudignore
Last active November 13, 2023 10:17
Ignore everything except allowed files in .gcloudignore
# Ignore everything
/[!.]*
/.?*
# Except the Cloud Function files we want to deploy
!/package.json
!/index.js
!/lib/**
#!include:.gitignore
@cbandy
cbandy / dates.tsv
Created March 4, 2017 02:23
Go Support Lifecycle
Version Released End of Patch End of Security
1.4 2014-12-10 2015-08-19 2016-02-17
1.5 2015-08-19 2016-02-17 2016-08-15
1.6 2016-02-17 2016-08-15 2017-02-16
1.7 2016-08-15 2017-02-16 ?
1.8 2017-02-16 ? ?
type repo struct {
execSQL func(query string, args ...interface{}) (sql.Result, error)
queryRow func(query string, args ...interface{}) func(dest ...interface{}) error
}
func NewRepo(db *sql.DB) repo {
return repo{
execSQL: db.Exec,
queryRow: func(query string, args ...interface{}) func(...interface{}) error {
return db.QueryRow(query, args...).Scan
@cbandy
cbandy / codec.go
Created February 10, 2015 06:29
Simple but slow way to decode PostgreSQL timestamptz
func decodeTimestamptzISO(s []byte) time.Time {
if s[4] != '-' {
// Replace year with a 4-digit year that can be parsed
yearSep := bytes.IndexByte(s, '-')
year, _ := strconv.Atoi(string(s[:yearSep]))
replaced := append([]byte(`9600`), s[yearSep:]...)
// Add back remaining years
return decodeTimestamptzISO(replaced).AddDate(year-9600, 0, 0)
}
psql -qAt -F $'\t' -c "select 'OID_' || upper(typname) || '=' || oid from pg_type where oid < 10000 and typname "'!~'" '^_'"
@cbandy
cbandy / file_sizes.txt
Last active August 29, 2015 14:02
Play with libsolv
$ ls -lvh ~/.gem/specs/*/*specs*
-rw-rw-r-- 1 cbandy cbandy 1.9M Mar 6 05:45 ~/.gem/specs/api.rubygems.org%443/latest_specs.4.8
-rw-rw-r-- 1 cbandy cbandy 1.9M Mar 7 14:25 ~/.gem/specs/rubygems.org%80/latest_specs.4.8
-rw-rw-r-- 1 cbandy cbandy 5.6M Mar 6 05:38 ~/.gem/specs/rubygems.org%80/specs.4.8
-rw-rw-r-- 1 cbandy cbandy 2.0M Jun 4 05:00 ~/.gem/specs/rubygems.org%443/latest_specs.4.8
-rw-rw-r-- 1 cbandy cbandy 6.0M Jun 17 13:50 ~/.gem/specs/rubygems.org%443/specs.4.8
$ ls -lvh rubygems.solv
-rw-rw-r-- 1 cbandy cbandy 3.1M Jun 17 13:51 rubygems.solv