Skip to content

Instantly share code, notes, and snippets.

@bashcoder
bashcoder / Gemfile
Last active August 29, 2015 14:07 — forked from stevebourne/Gemfile
gem 'omniauth'
gem 'omniauth-facebook'
gem 'clearance'
#!/usr/local/bin/python
"""
To use this script, you must be in the root directory of a Rails project that
is using git. You should also make sure that your directory does not contain any
uncommitted changes. Then run:
$ python rails_switch_branch.py name_of_another_branch
Running the above will do the following:
@bashcoder
bashcoder / vim-ruby-folding-1.1.vim
Created October 24, 2013 14:33
vim ruby folding for methods
" FoldSearch-based folding.
" Copyright (C) 2005 Mauricio Fernandez <mfp@acm.org>
" Current version: http://eigenclass.org/hiki.rb?Usable+Ruby+folding+for+Vim
"
" Add this to your .vimrc and fold with :R. The default fold expression will
" work with Ruby scripts; you can specify where folds start with
" let b:foldsearchexpr = 'myexpression'
" e.g.
" let b:foldsearchexpr='\(^\s*\(\(private\|public\|protected\|class\)\s\)\)'
" or so for Java.
cd ~
sudo apt-get update
sudo apt-get install openjdk-7-jre-headless -y
### Check http://www.elasticsearch.org/download/ for latest version of ElasticSearch and replace wget link below
# NEW WAY / EASY WAY
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.90.5.deb
sudo dpkg -i elasticsearch-0.90.5.deb
@bashcoder
bashcoder / switch_to_test
Created September 23, 2013 18:25
From my .vimrc, switch between test and production code with `<leader>.`
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" SWITCH BETWEEN TEST AND PRODUCTION CODE
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
function! OpenTestAlternate()
let new_file = AlternateForCurrentFile()
exec ':e ' . new_file
endfunction
function! AlternateForCurrentFile()
let current_file = expand("%")
let new_file = current_file
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
@bashcoder
bashcoder / .gemrc
Created August 13, 2013 18:08
My ~/.gemrc file, which disables documentation during gem updates and installs.
install: --no-rdoc --no-ri
update: --no-rdoc --no-ri
#
# Author:: Christopher Peplin (<peplin@bueda.com>)
# Copyright:: Copyright (c) 2010 Bueda, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
@bashcoder
bashcoder / logstash_apache_json_macro.conf
Created August 4, 2013 18:15
Logstash JSON logging in Apache, using mod_macro. Debugged and enhanced from the original version found at: http://cookbook.logstash.net/recipes/apache-json-logs/
# logstash_apache_json_macro.conf
#
# Create a Macro named logstash_log that is used in the VirtualHost
# It defines, on the fly, a macro for the specific vhost $servername
# and anchors its @source, $source_host and @source_path.
#
# In addition, it prevents any non-page resources from getting logged.
#
# It also adds three tags: web, apache, and the servername
#
@bashcoder
bashcoder / adduser
Created August 3, 2013 23:15 — forked from piavlo/adduser
adduser --home-dir /var/lib/logstash --no-create-home --shell /sbin/nologin logstash
mkdir -p /var/lib/logstash /var/log/logstash
chown -R logstash:logstash /var/lib/logstash /var/log/logstash