Skip to content

Instantly share code, notes, and snippets.

View gmonfort's full-sized avatar

German Monfort gmonfort

  • MvdLink
  • Montevideo
View GitHub Profile
@juno
juno / custom_log_formatter.rb
Created August 12, 2015 08:23
Custom log formatter which supprots severity and progname. This works well with Heroku's rails_12factor.gem
# Custom log formatter module for rails_12factor
#
module CustomLogFormatter
# Custom formatter for development environment.
#
# Examples
#
# # in controller
# logger.error(self.class) { 'This is a error message' }
# logger.info { 'This is a info message' }
@mdwheele
mdwheele / yosemite-sound-issues.md
Created October 22, 2014 00:25
Fix Yosemite Bluetooth Sound Issues
  1. Run the following in your terminal.
defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Max (editable)" 80
defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" 80
defaults write com.apple.BluetoothAudioAgent "Apple Initial Bitpool (editable)" 80
defaults write com.apple.BluetoothAudioAgent "Apple Initial Bitpool Min (editable)" 80
defaults write com.apple.BluetoothAudioAgent "Negotiated Bitpool" 80
defaults write com.apple.BluetoothAudioAgent "Negotiated Bitpool Max" 80
defaults write com.apple.BluetoothAudioAgent "Negotiated Bitpool Min" 80
@willurd
willurd / web-servers.md
Last active November 13, 2024 13:44
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@ruckus
ruckus / statistics.sql
Created June 5, 2013 23:26
Postgres statistics queries
** Find commmonly accessed tables and their use of indexes:
SELECT relname,seq_tup_read,idx_tup_fetch,cast(idx_tup_fetch AS numeric) / (idx_tup_fetch + seq_tup_read) AS idx_tup_pct FROM pg_stat_user_tables WHERE (idx_tup_fetch + seq_tup_read)>0 ORDER BY idx_tup_pct;
Returns output like:
relname | seq_tup_read | idx_tup_fetch | idx_tup_pct
----------------------+--------------+---------------+------------------------
schema_migrations | 817 | 0 | 0.00000000000000000000
user_device_photos | 349 | 0 | 0.00000000000000000000
@robzolkos
robzolkos / 0-readme.md
Created June 20, 2012 05:49 — forked from lazyatom/0-readme.md
ruby-1.9.3-p194 cumulative performance patch.

Patched ruby 1.9.3-p194 for 30% faster rails boot

What is?

This script installs a patched version of ruby 1.9.3-p194 with patches for boot-time performance improvements (#66 and #68), and runtime performance improvements (#83 and #84). It also includes the new backported GC from ruby-trunk.

Huge thanks to funny-falcon for the performance patches.

@dplummer
dplummer / tcmalloc.patch
Created June 30, 2011 20:50
ree tcmalloc patch fix for glibc 2.14
diff -urB a/distro/google-perftools-1.7/src/tcmalloc.cc b/distro/google-perftools-1.7/src/tcmalloc.cc
--- a/distro/google-perftools-1.7/src/tcmalloc.cc
+++ b/distro/google-perftools-1.7/src/tcmalloc.cc
@@ -137,6 +137,13 @@
# define WIN32_DO_PATCHING 1
#endif
+// GLibc 2.14+ requires the hook functions be declared volatile, based on the value of the
+// define __MALLOC_HOOK_VOLATILE. For compatibility with older/non-GLibc implementations,
+// provide an empty definition.
@dplummer
dplummer / gist:1057203
Created June 30, 2011 20:48
Fix for rvm install 1.8.7 with glibc 2.14
glibc 2.14 breaks the install process for ruby 1.8.7 and ree 1.8.7.
Fix for ruby 1.8.7 install with rvm:
1. Run `rvm install ruby-1.8.7-p334`
2. Wait for it to fail.
3. Fix the broken files with:
cd ~/.rvm/src/ree-1.8.7-2011.03/source/ext/dl
rm callback.func
touch callback.func
ruby mkcallback.rb >> callback.func
@gmonfort
gmonfort / debian6-rvm-ree-gems.erb
Created June 6, 2011 05:28
bootstrap a debian 6 node with rvm and ree patched to avoid SSLv2 issues
# Debian 6 bootstrap template file for chef
#
# Installs RVM and ruby enterprise edition (ree) patched to workaround
# issues with SSLv2 in debian systems (SSLv2 is deprecated)
#
# Also only installs ruby dependencies listed in `rvm notes`
#
# RVM is installed system-wide in /usr/local/rvm
#
# Usage: