Skip to content

Instantly share code, notes, and snippets.

@pbrit
pbrit / gist:3864530
Created October 10, 2012 10:08
Clean up database
ActiveRecord::Base.descendants.reject { |el| [User,Page].include?(el) }.each { |el| el.destroy_all("id > 10") }.map { |el| [el.count,el] }
@pbrit
pbrit / Enable network storage for TimeMachine
Created October 19, 2012 21:50
Setup TimeMachine on Ubuntu
defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1
@pbrit
pbrit / gist:4275022
Created December 13, 2012 08:36
Exception in premailer-rails3 gem when there is no css in view
#<NoMethodError: undefined method `[]' for nil:NilClass>
["/usr/local/rvm/gems/ruby-1.9.2-p320/gems/premailer-rails3-1.3.1/lib/premailer-rails3/css_loaders.rb:65:in `request_and_unzip'",
"/usr/local/rvm/gems/ruby-1.9.2-p320/gems/premailer-rails3-1.3.1/lib/premailer-rails3/css_loaders.rb:43:in `load'",
"/usr/local/rvm/gems/ruby-1.9.2-p320/gems/premailer-rails3-1.3.1/lib/premailer-rails3/css_helper.rb:44:in `block in load_css'",
"/usr/local/rvm/gems/ruby-1.9.2-p320/gems/premailer-rails3-1.3.1/lib/premailer-rails3/css_helper.rb:43:in `each'",
"/usr/local/rvm/gems/ruby-1.9.2-p320/gems/premailer-rails3-1.3.1/lib/premailer-rails3/css_helper.rb:43:in `load_css'",
"/usr/local/rvm/gems/ruby-1.9.2-p320/gems/premailer-rails3-1.3.1/lib/premailer-rails3/css_helper.rb:22:in `css_for_doc'",
"/usr/local/rvm/gems/ruby-1.9.2-p320/gems/premailer-rails3-1.3.1/lib/premailer-rails3/premailer.rb:14:in `initialize'",
"/usr/local/rvm/gems/ruby-1.9.2-p320/gems/premailer-rails3-1.3.1/lib/premailer-rails3/hook.rb:18:in `new'",
@pbrit
pbrit / gist:4372529
Last active December 10, 2015 03:08
Install GNUstep to CentOS 6 from source code
# Install prerequsites
# NOTE: libffi version >= 3.0.5
yum install libxml2-devel libxslt-devel gnutls libicu-devel libffi-devel
# Download source codes
svn co http://svn.gna.org/svn/gnustep/modules/cor
# Install gnu-make
cd make
./configure && make && make install
@pbrit
pbrit / gist:4373317
Created December 25, 2012 13:44
Github webhook
{
"before": "5aef35982fb2d34e9d9d4502f6ede1072793222d",
"repository": {
"url": "http://github.com/defunkt/github",
"name": "github",
"description": "You're lookin' at it.",
"watchers": 5,
"forks": 2,
"private": 1,
"owner": {
@pbrit
pbrit / gist:4502437
Created January 10, 2013 14:31
Recovery yum database
rm -f /var/lib/rpm/__db*
rpm –rebuilddb
yum clean all
@pbrit
pbrit / gist:5309970
Last active December 15, 2015 19:18
Puppet REST api
# Command to communicate with puppet
curl --cert /etc/puppet/ssl/certs/puppet..pem \
--key /etc/puppet/ssl/private_keys/puppet..pem \
--cacert /etc/puppet/ssl/ca/ca_crt.pem \
-H 'Accept: yaml' \
https://puppet.:8140/production/catalog/puppet-inv.local
#
# Paths
#
@pbrit
pbrit / file.rb
Last active December 15, 2015 19:18
Puppet: Get file content for File resource with content attribute
#
# Purpose: Get content of file from Puppet catalog
#
# Usage: ruby file.rb args
# Args:
# | Name | Desc | Default
# ------------------------------------------
# | node | |
# | path | \
# | environment | production \
@pbrit
pbrit / gist:5784312
Created June 14, 2013 18:55
How to disable color logging in ActiveRecord
ActiveSupport::LogSubscriber.colorize_logging = false
@pbrit
pbrit / gist:6702210
Created September 25, 2013 16:27
vim-fireplace help
*fireplace.txt* Clojure REPL tease
Author: Tim Pope <http://tpo.pe/>
License: Same terms as Vim itself (see |license|)
This plugin is only available if 'compatible' is not set.
*fireplace*
You need Clojure runtime files to use this plugin. Try vim-clojure-static.