Skip to content

Instantly share code, notes, and snippets.

@paulmars
paulmars / gist:349729
Created March 30, 2010 23:16
See which commands in your bash history you execute the most
irb
require 'pp'; command = {}; `cat .bash_history`.split("\n").map{|x| x.split(" ").first }.each{|c| command[c] ||= 0; command[c] += 1 }; pp command.sort{|x,y| x[1] <=> y[1] }
@paulmars
paulmars / gist:522184
Created August 13, 2010 03:01
Vagrant config for riak
Vagrant::Config.run do |config|
config.vm.forward_port("ssh", 22, 2222)
config.vm.forward_port("riak", 8098, 8098)
config.vm.box = "base"
config.vm.provisioner = :chef_solo
config.chef.cookbooks_path = "cookbooks"
config.chef.run_list.clear
config.chef.add_recipe("riak")
@paulmars
paulmars / template.rb
Last active September 25, 2015 17:57 — forked from martinisoft/tpl-cukeapp.rb
Rails, RSpec, Factory_Girl, SASS, Devise, Rails Admin
# rails new [appname] -JT -m https://gist.githubusercontent.com/paulmars/960988/raw/386eb14e20153ef4d55a6735d22748c6503b64f8/template.rb
# rails new APPNAME -JT -m /Users/paul/Development/template/template.rb
# sass
gem 'sass-rails'
gem 'bootstrap-sass', '3.2.0.2'
# image update
gem 'carrierwave', '0.10.0'
gem 'fog', '1.19.0'
@paulmars
paulmars / gist:1375098
Created November 18, 2011 00:30
HTTPS only with redirect from http
server {
listen 443;
}
server {
listen 80;
rewrite ^(.*) https://$host$1 permanent;
}
@paulmars
paulmars / gist:1375125
Created November 18, 2011 00:44
Quiet Assets for Rails
Source:
http://stackoverflow.com/questions/6312448/how-to-disable-logging-of-asset-pipeline-sprockets-messages-in-rails-3-1
mate config/initializers/quiet_assets.rb
Paste:
Rails.application.assets.logger = Logger.new('/dev/null')
Rails::Rack::Logger.class_eval do
def call_with_quiet_assets(env)
previous_level = Rails.logger.level
@paulmars
paulmars / gist:1375582
Created November 18, 2011 04:11
Find all the computers connected to your home network
where 10.0.1.255 is the subnet mast
~ ping 10.0.1.255
PING 10.0.1.255 (10.0.1.255): 56 data bytes
64 bytes from 10.0.1.193: icmp_seq=0 ttl=64 time=0.190 ms
64 bytes from 10.0.1.1: icmp_seq=0 ttl=255 time=2.565 ms
64 bytes from 10.0.1.11: icmp_seq=0 ttl=64 time=583.688 ms
64 bytes from 10.0.1.19: icmp_seq=0 ttl=64 time=583.944 ms
64 bytes from 10.0.1.21: icmp_seq=0 ttl=255 time=586.059 ms
64 bytes from 10.0.1.193: icmp_seq=1 ttl=64 time=0.205 ms
@paulmars
paulmars / gist:1379543
Created November 19, 2011 23:35
Connect/NodeJS Parameter Logging
sys = require 'sys'
exports.paramsLogger = () ->
(req, res, next) ->
console.log("Query: " + sys.inspect(req.query)) if req.query
console.log("Body: " + sys.inspect(req.body)) if req.body
console.log("=============")
next()
@paulmars
paulmars / Default
Last active August 7, 2020 00:26
Sublime Text 3
{
"auto_complete": false,
"caret_style": "phase",
"draw_minimap_border": true,
"file_exclude_patterns":
[
".out",
".DS_Store",
"dblocal.sql"
],
@paulmars
paulmars / import_tumblr_to_jekyll.rb
Created January 19, 2012 21:31 — forked from jccovey/import_tumblr_to_jekyll.rb
Quick script to import tumblr posts to jekyll markdown'd posts
#!/usr/bin/env ruby
# Script to import tumblr posts into local markdown posts ready to be consumed by Jekyll.
# Inspired by New Bamboo's post http://blog.new-bamboo.co.uk/2009/2/20/migrating-from-mephisto-to-jekyll
require 'rubygems'
require 'open-uri'
require 'nokogiri'
# Configuration
@paulmars
paulmars / tumblr.rb
Created January 19, 2012 21:40 — forked from derek-watson/tumblr.rb
Tumblr to Jekyll migration
#!/usr/bin/env ruby
# Script to import tumblr posts into local markdown posts ready to be consumed by Jekyll.
# Inspired by New Bamboo's post http://blog.new-bamboo.co.uk/2009/2/20/migrating-from-mephisto-to-jekyll
# Supports post types: regular, quote, link, photo, video and audio
# Saves local copies of images
require 'rubygems'
require 'open-uri'
require 'nokogiri'