Skip to content

Instantly share code, notes, and snippets.

View coryt's full-sized avatar
💡
Learning

Cory Taylor coryt

💡
Learning
View GitHub Profile
@coryt
coryt / go-shebang-story.md
Created April 10, 2020 03:40 — forked from posener/go-shebang-story.md
Story: Writing Scripts with Go

Story: Writing Scripts with Go

This is a story about how I tried to use Go for scripting. In this story, I’ll discuss the need for a Go script, how we would expect it to behave and the possible implementations; During the discussion I’ll deep dive to scripts, shells, and shebangs. Finally, we’ll discuss solutions that will make Go scripts work.

Why Go is good for scripting?

While python and bash are popular scripting languages, C, C++ and Java are not used for scripts at all, and some languages are somewhere in between.

@coryt
coryt / shell.exs
Created April 10, 2020 04:25 — forked from iboard/shell.exs
Elixir-script template for the commandline.
#!/usr/bin/env elixir
#
# A Template for writing an Elixir script to be used on the
# command-line.
#
# (c) 2019 by Andreas Altendorfer <[email protected]>
# License: Free to use without any warranty.
#
# Usage:
# 1. Add your command to strict and aliases on @opts
@coryt
coryt / postgres_queries_and_commands.sql
Created August 12, 2021 23:24 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'