Skip to content

Instantly share code, notes, and snippets.

Avatar
⁉️

Bryan Stearns bryanstearns

⁉️
View GitHub Profile
@bryanstearns
bryanstearns / rn_rebuild
Last active Jun 6, 2019
Clean rebuild script for React Native, handy when upgrading dependencies
View rn_rebuild
#!/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.
View erlinit.config
# 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 / gist:4331076
Created Dec 18, 2012
I put this in my basebox postinstall scripts to help NTP deal with large time differences
View gist:4331076
# 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
@bryanstearns
bryanstearns / custom_bootstrap.erb
Created Jul 31, 2012
Customized bootstrap to add the private IP address to /etc/network/interfaces and set up Linsides' apt-cacher proxy
View custom_bootstrap.erb
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 Jun 3, 2012 — forked from benhamill/output
rbenv REE installation with patches
View output
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 Dec 14, 2011
config/initializers/backtrace_links.rb
View backtrace_links.rb
@bryanstearns
bryanstearns / newrelic_stfu.rb
Created Dec 6, 2011
config/initializers/newrelic_stfu.rb
View 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
View recolorize_logging.rb
# 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 Mar 2, 2011
output of rvm --trace rubygems 1.4.2
View output of rubygems.install.log
+ [[ -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 ]]
View gist:850257
root@vbox3:/usr/local/rvm/src/rubygems-1.4.1# ls -R
.:
bin cruise_config.rb hide_lib_for_update lib Manifest.txt Rakefile README.rdoc test
ChangeLog GPL.txt History.txt LICENSE.txt pkgs README setup.rb util
./bin:
gem update_rubygems
./hide_lib_for_update:
note.txt