Skip to content

Instantly share code, notes, and snippets.

Jonathan Keam jkeam

Block or report user

Report or block jkeam

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jkeam
jkeam / encode_base64.sh
Created May 29, 2019
Encode a file into a base 64 format
View encode_base64.sh
#!/bin/bash
# -A doesn't print out newlines and entire file will be on a single line.
openssl base64 -A -in ./input_file -out ./output_file
@jkeam
jkeam / show_codesigning_identities.sh
Created May 12, 2019
A lot of times building things on Macs require you to use to a codesigning identity. This quick one-liner will show you your code signing identities.
View show_codesigning_identities.sh
#!/bin/bash
security find-identity -v -p codesigning
View heroku_postgres_table_dump.sh
# get database info
heroku config:get DATABASE_URL -a app_name
# dump command
pg_dump --column-inserts --no-acl --no-owner -h host_name -U postgres_user -t table_name --data-only db_name > output_filename.dump
View setup_postgres.sh
# install postgres
sudo apt update
sudo apt install postgresql postgresql-contrib libpq-dev
# login as postgres user
sudo -i -u postgres
# log into psql shell
psql
@jkeam
jkeam / mac_ip.sh
Created Dec 25, 2018
Get My Mac IP
View mac_ip.sh
#!/bin/bash
#ifconfig en0 | grep 'inet ' | awk '{print $2}'
ipconfig getifaddr en0
@jkeam
jkeam / getcert.sh
Last active Jan 25, 2018
Get SSL Cert
View getcert.sh
#!/bin/sh
#
# usage: getcert.sh remote.host.name [port]
# eg) getcert.sh api.mailgun.net
#
RHOST=$1
RPORT=${2:-443}
# see cert
echo -n | openssl s_client -connect ${RHOST}:${RPORT} | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p'
View python_installation_notes
Install These Tools:
https://github.com/pyenv/pyenv
https://github.com/pyenv/pyenv-virtualenv
Then in .zshrc add:
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
@jkeam
jkeam / escape_newline.sh
Created Oct 12, 2017
I used this when taking multiline configs, like rsa keys to a single line that .env files can use.
View escape_newline.sh
awk '{printf "%s\\n", $0}' file
@jkeam
jkeam / replace_expo_urls.rb
Last active Aug 1, 2017
Ruby script to update expo config files that need to be updated as you change networks. This script will update the urls expo is using to serve up the JS resources. This configs should be auto updated during the build process, but for some reason it sometimes does not work. Running this script will fix those urls.
View replace_expo_urls.rb
#!/usr/bin/env ruby
require 'json'
require 'rexml/document'
include REXML
def fix_exshell_json(filename, url)
json_file = JSON.parse File.read(filename)
json_file['developmentUrl'] = url
File.open(filename, 'w') { |file| file.puts(json_file.to_json) }
end
View zoos_and_animals.viz
digraph SimplestDiagrams {
Zoo1
"Zoo1" -> "Cat"
"Zoo1" -> "Dog"
Zoo2
"Zoo2" -> "Cat"
"Zoo2" -> "Crow"
Zoo3
You can’t perform that action at this time.