Skip to content

Instantly share code, notes, and snippets.

View toddsiegel's full-sized avatar

Todd Siegel toddsiegel

  • Solera Software, Inc.
  • Denver, CO
  • 09:58 (UTC -06:00)
View GitHub Profile
@toddsiegel
toddsiegel / LogEntry.java
Last active August 21, 2019 21:29
Ingesting a CSV using OpenCSV
package com.solera.domain;
import com.opencsv.bean.CsvBindByName;
import java.util.Objects;
public class LogEntry {
@CsvBindByName(column = "insertId")
private String insertId;
@toddsiegel
toddsiegel / introspection.sql
Last active December 29, 2023 21:35
Helpful PostgreSQL Queries
-- List all Foreign Keys
select kcu.table_schema || '.' ||kcu.table_name as foreign_table,
'>-' as rel,
rel_tco.table_schema || '.' || rel_tco.table_name as primary_table,
string_agg(kcu.column_name, ', ') as fk_columns,
kcu.constraint_name
from information_schema.table_constraints tco
join information_schema.key_column_usage kcu
on tco.constraint_schema = kcu.constraint_schema
and tco.constraint_name = kcu.constraint_name
@toddsiegel
toddsiegel / file.sh
Created November 6, 2018 20:37
Useful bash stuff
# `read`
## Basic usage
$ read -p "Useful prompt goes here"
## Use readline
$ read -e -p "..."
gem 'pg'
gem 'puma'
gem 'rack-attack'
gem 'rollbar'
gem_group :development, :test do
gem 'rubocop'
end
gem_group :test do
@toddsiegel
toddsiegel / mysql_admin.sql
Created February 14, 2018 18:43
MySQL Admin Queries
SELECT t.table_name, ccsa.character_set_name
FROM information_schema.tables t
JOIN information_schema.collation_character_set_applicability ccsa
ON ccsa.collation_name = t.table_collation
WHERE t.table_schema = '<schema_name>'
ORDER BY t.table_name
@toddsiegel
toddsiegel / setup.md
Last active July 14, 2017 18:01
Setting up a sane Rails development environment on Mint Linux

Installing rebenv

Mint comes with a ruby package installed. It is installed as the root user and is not the latest version. We want the flexibility to install the latest version, to be able to easily upgrade and not have the hassles of installing gems as root.

To do this we need to use Ruby environment manager. This allows everyone on your team to be on the same version of Ruby, regardless of OS. This can be locked in with a .ruby-version in the root directory of your project.

I recommend rbenv to do this.

Dependencies

The software we're installing needs a few dependencies installed in order to work.

# Linux Primer
## Where am I?
It can be intimidating when you are first confronted with prompt because you do not no where you are and what to do. This first section aims to help you orient yourself on any Linux system.
### The `pwd` command
`pwd`
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
@toddsiegel
toddsiegel / minimal_csp.txt
Last active May 25, 2017 15:56
A default, minimal content security policy
# This allows stylesheets, scripts and images from the same origin host, but nothing else.
Content-Security-Policy: default-src 'none'; script-src 'self'; style-src 'self'; img-src 'self'
@toddsiegel
toddsiegel / tmux-cheatsheet.md
Last active February 27, 2017 16:23 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname