Skip to content

Instantly share code, notes, and snippets.

View bryanstearns's full-sized avatar
⁉️

Bryan Stearns bryanstearns

⁉️
View GitHub Profile
@bryanstearns
bryanstearns / rn_rebuild
Last active November 21, 2022 21:34
Clean rebuild script for React Native, handy when upgrading dependencies
#!/bin/bash
# Do clean rebuilds of both platforms after reinstalling fresh dependencies
# Useful during (eg) periodic upgrades of dependencies, to make sure everything
# still works at each step. Run one iOS and one Android simulator first.
# Keep this script outside your source tree (eg, /usr/local/bin/rn_rebuild)
set -x # echo each command
set -e # die on error (except when we "|| set exit 0")
# Extract our app's bundle ID.
@bryanstearns
bryanstearns / gist:4331076
Created December 18, 2012 19:23
I put this in my basebox postinstall scripts to help NTP deal with large time differences
# Make sure ntpd doesn't give up if the time is way off
cp /etc/ntp.conf /etc/ntp.conf.old
(echo tinker panic 0; cat /etc/ntp.conf.old) >/etc/ntp.conf
/etc/init.d/ntp restart
# Additional configuration for erlinit
# Customized (see BJS) from the nerves default
# from deps/nerves_system_rpi2/rootfs-additions/etc/erlinit.config
# Turn on the debug prints
#-v
# Specify the UART port that the shell should use.
# BJS: was -c tty1
-c ttyS0
@bryanstearns
bryanstearns / custom_bootstrap.erb
Created July 31, 2012 00:07
Customized bootstrap to add the private IP address to /etc/network/interfaces and set up Linsides' apt-cacher proxy
bash -c '
<%= "export http_proxy=\"#{knife_config[:bootstrap_proxy]}\"" if knife_config[:bootstrap_proxy] -%>
<% private_ip = (@config[:first_boot_attributes]["ip_addresses"] || []).select{|x| x =~ /^192.168/ }.first
if private_ip -%>
function add_private_network_and_proxy() {
cat <<'EOP' >>/etc/network/interfaces
auto eth0:0
iface eth0:0 inet static
@bryanstearns
bryanstearns / output
Created June 3, 2012 17:37 — forked from benhamill/output
rbenv REE installation with patches
Downloading http://rubyenterpriseedition.googlecode.com/files/ruby-enterprise-1.8.7-2012.02.tar.gz...
Installing ruby-enterprise-1.8.7-2012.02...
--2012-06-03 11:59:59-- https://github.com/wayneeseguin/rvm/raw/master/patches/ree/1.8.7/tcmalloc.patch
Resolving github.com (github.com)... 207.97.227.239
Connecting to github.com (github.com)|207.97.227.239|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://raw.github.com/wayneeseguin/rvm/master/patches/ree/1.8.7/tcmalloc.patch [following]
--2012-06-03 12:00:00-- https://raw.github.com/wayneeseguin/rvm/master/patches/ree/1.8.7/tcmalloc.patch
Resolving raw.github.com (raw.github.com)... 207.97.227.243
Connecting to raw.github.com (raw.github.com)|207.97.227.243|:443... connected.
@bryanstearns
bryanstearns / backtrace_links.rb
Created December 14, 2011 01:21
config/initializers/backtrace_links.rb
@bryanstearns
bryanstearns / newrelic_stfu.rb
Created December 6, 2011 00:31
config/initializers/newrelic_stfu.rb
# NewRelic really wants me to know when it's not running. I don't care.
module NewRelic
class Control
module Frameworks
class Rails
def log_with_quieting!(msg, level=:info)
log_without_quieting!(msg, level) \
unless msg == "New Relic Agent not running."
end
alias_method_chain :log!, :quieting
# Monkeypatch the activerecord logger to colorize database-changing statements different
# from non-changing statements (instead of the blue-baring it does by default)
class ActiveRecord::ConnectionAdapters::AbstractAdapter
protected
def format_log_entry(message, dump = nil)
if ActiveRecord::Base.colorize_logging
if message =~ / (Update|Create) /
message_color, dump_color = "4;35;1", "0"
else
@bryanstearns
bryanstearns / output of rubygems.install.log
Created March 2, 2011 02:13
output of rvm --trace rubygems 1.4.2
+ [[ -z '' ]]
+ export 'PS4=+[${BASH_SOURCE}] : ${LINENO} : ${FUNCNAME[0]:+${FUNCNAME[0]}() $ }'
+ PS4='+[${BASH_SOURCE}] : ${LINENO} : ${FUNCNAME[0]:+${FUNCNAME[0]}() $ }'
+[/usr/local/rvm/scripts/cli] : 709 : __rvm_parse_args() $ [[ -z '' ]]
+[/usr/local/rvm/scripts/cli] : 709 : __rvm_parse_args() $ [[ -n '' ]]
+[/usr/local/rvm/scripts/cli] : 711 : __rvm_parse_args() $ [[ 0 -eq 1 ]]
+[/usr/local/rvm/scripts/cli] : 711 : __rvm_parse_args() $ [[ -n '' ]]
+[/usr/local/rvm/scripts/cli] : 31 : __rvm_parse_args() $ [[ -n rubygems ]]
+[/usr/local/rvm/scripts/cli] : 33 : __rvm_parse_args() $ rvm_token=rubygems
+[/usr/local/rvm/scripts/cli] : 35 : __rvm_parse_args() $ [[ 1 -gt 0 ]]
@bryanstearns
bryanstearns / gist:850235
Created March 2, 2011 00:52
rvm --trace rubygems 1.4.1
root@vbox3:~# rvm info
ree-1.8.7-2011.03:
system:
uname: "Linux vbox3 2.6.32-29-generic-pae #58-Ubuntu SMP Fri Feb 11 19:15:25 UTC 2011 i686 GNU/Linux"
bash: "/bin/bash => GNU bash, version 4.1.5(1)-release (i486-pc-linux-gnu)"
zsh: " => not installed"
rvm: