Skip to content

Instantly share code, notes, and snippets.

Avatar
:shipit:

Chris Castle crcastle

:shipit:
View GitHub Profile
@crcastle
crcastle / brew-updates.1h.sh
Created Dec 9, 2020
My BitBar enabled plugins - heroku, homebrew, github, and googlecal
View brew-updates.1h.sh
#!/bin/bash
# <bitbar.title>Homebrew Updates</bitbar.title>
# <bitbar.author>killercup</bitbar.author>
# <bitbar.author.github>killercup</bitbar.author.github>
# <bitbar.desc>List available updates from Homebrew (OS X)</bitbar.desc>
exit_with_error() {
echo "err | color=red";
exit 1;
}
@crcastle
crcastle / prompt_purewildcherry_setup.zsh
Created Jun 22, 2018
Heroku customized command prompt with ZSH and Prezto
View prompt_purewildcherry_setup.zsh
# Pure
# by Sindre Sorhus
# https://github.com/sindresorhus/pure
# MIT License
# For my own and others sanity
# git:
# %b => current branch
# %a => current action (rebase/merge)
# prompt:
@crcastle
crcastle / volition-build-log-fail.sh
Created Feb 13, 2018
Volition build failing on Heroku
View volition-build-log-fail.sh
! Warning: Multiple default buildpacks reported the ability to handle this app. The first buildpack in the list below will be used.
Detected buildpacks: Ruby,Node.js
See https://devcenter.heroku.com/articles/buildpacks#buildpack-detect-order
-----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.4.0
-----> Installing dependencies using bundler 1.15.2
Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
Your Gemfile lists the gem premailer-rails (>= 0) more than once.
You should probably keep only one of them.
@crcastle
crcastle / commands.sh
Last active Jan 10, 2018
Heroku: Scale from 0 to 100 servers in 5 minutes
View commands.sh
# Prep
# Do this in a team, not personal app, because we don't want to use Free/Hobby
export HEROKU_ORGANIZATION=demo-org
####### Start Demo Here
# I'm going to deploy a simple app to Heroku
# Add a new "feature"
# Scale it up to 100 servers (cause our company got mentioned on Techcrunch!)
# Then scale it down to 20 (to save $$$ since the load has gone down)
# And I'm going to do all this in less than 5 minutes (might need to be 7 or 10 min)
@crcastle
crcastle / server.js
Last active Jan 24, 2018
Simplest Node.js Web Server
View server.js
const http = require('http')
const PORT = 3000
const requestHandler = (request, response) => {
response.end('Hello World!')
}
const server = http.createServer(requestHandler)
server.listen(PORT, (err) => {
View gist:9b6512564c9660cbfac8420833253644
  ~/src/kafka-streams-on-heroku  master 🌷  59s
👉 h kafka:topics:write tombigbee-17823.textlines "the quick brown fox jumps over the lazy dog" -a kafka-streams-test
  ~/src/kafka-streams-on-heroku  master 🌷 
👉 heroku pg:psql -c 'select * from windowed_counts' HEROKU_POSTGRESQL_URL -a kafka-streams-test
--> Connecting to postgresql-vertical-36453
┌────┬───────────────┬───────┬───────┐
│ id │ time_window │ word │ count │
├────┼───────────────┼───────┼───────┤
│ 21 │ 1512765050000 │ brown │ 1 │
@crcastle
crcastle / jsconf-eu-demos.md
Last active May 5, 2017
Some Node/JavaScript One-Click Heroku Deploys
View jsconf-eu-demos.md
@crcastle
crcastle / devoxx-demos.md
Last active Mar 21, 2017
Some Java One-Click Heroku Deploys
View devoxx-demos.md
@crcastle
crcastle / yarn_lock.sql
Created Mar 15, 2017
Google BigQuery SQL query for yarn.lock
View yarn_lock.sql
SELECT
repo_name,
COUNT(repo_name) AS count
FROM
[bigquery-public-data:github_repos.files]
WHERE
path LIKE 'yarn.lock'
GROUP BY
Repo_name
@crcastle
crcastle / get-kindle-highlights.rb
Created Jan 22, 2017
Extract Kindle highlights into CSV format for https://crc.io/projects/reading
View get-kindle-highlights.rb
require 'kindle_highlights'
kindle = KindleHighlights::Client.new(
email_address: 'amazon@crc.io',
password: '',
mechanize_options: { user_agent_alias: 'Mac Mozilla' }
)
puts 'quote_id,quote_link,quote_text,post_title,post_link,post_author,post_author_link,post_site_link,unix_time'
kindle.books.each do |asin, title|