Skip to content

Instantly share code, notes, and snippets.

View krisf's full-sized avatar

krisf krisf

  • The Internet
View GitHub Profile
Backup::Model.new(:appbackup, 'appbackup') do
store_with Local do |local|
local.path = '/backups/'
# Use a number or a Time object to specify how many backups to keep.
local.keep = 14
end
compress_with Bzip2
database PostgreSQL do |db|
# Use this file to easily define all of your cron jobs.
# #
# # It's helpful, but not entirely necessary to understand cron before proceeding.
# # http://en.wikipedia.org/wiki/Cron
#
# # Example:
# #
# # set :output, "/path/to/my/cron_log.log"
# #
# # every 2.hours do
@krisf
krisf / clean-up-boot-partition-ubuntu.md
Created February 10, 2017 19:47 — forked from ipbastola/clean-up-boot-partition-ubuntu.md
Safest way to clean up boot partition - Ubuntu 14.04LTS-x64

Safest way to clean up boot partition - Ubuntu 14.04LTS-x64

Reference

Case I: if /boot is not 100% full and apt is working

1. Check the current kernel version

$ uname -r 
@krisf
krisf / docker-compose-install.sh
Created February 21, 2016 19:06 — forked from marszall87/docker-compose-install.sh
Simple script for installing latest Docker Compose on CoreOS >= 717.0.0
#!/bin/bash
mkdir -p /opt/bin
curl -L `curl -s https://api.github.com/repos/docker/compose/releases/latest | jq -r '.assets[].browser_download_url | select(contains("Linux") and contains("x86_64"))'` > /opt/bin/docker-compose
chmod +x /opt/bin/docker-compose
@krisf
krisf / install-squid.sh
Created October 28, 2015 23:46 — forked from cdodd/install-squid.sh
Install a basic squid proxy with authentication on Centos 6 x64. Just modify the variables at the top and run the script on a clean system.
#!/bin/sh
PROXY_USER=user
PROXY_PASS=password
PROXY_PORT=3128
# Clear the repository index caches
yum clean all
# Update the operating system
# Textmate essential bundles
cd ~/Library/Application\ Support/TextMate/Pristine\ Copy/Bundles
# mkdir -p cd /Applications/TextMate.app/Contents/SharedSupport/Bundles
git clone git://github.com/protocool/ack-tmbundle.git Ack.tmbundle
git clone git://github.com/textmate/ruby-haml.tmbundle.git
git clone git://github.com/seaofclouds/sass-textmate-bundle.git "Ruby Saas.tmbundle"
git clone https://github.com/aslakhellesoy/cucumber-tmbundle.git Cucumber.tmbundle
git clone git://github.com/karnowski/blue-ridge-tmbundle.git JavaScript\ Blue\ Ridge.tmbundle
git clone git://github.com/johnmuhl/nginx-tmbundle.git nginx.tmbundle
@krisf
krisf / enc
Last active August 13, 2022 00:02
decrypts OpenSSL encrypted files from ruby Backup gem
#!/bin/bash
#encrypt files with aes-256-cbc cipher using openssl
#install:
# sudo wget -O /usr/bin/enc https://gist.github.com/krisf/5391210/raw/4a105a6b8f98f39e9e74a1dd2a78ef6f631acdb1/enc
# sudo chmod +x /usr/bin/enc
# enc --help
#encrypt files
if [ $1 == "-e" ];
then
#Theirs:
class UsersController < ApplicationController
def follow
@user = User.find(params[:id])
if current_user.follow(@user)
redirect_to root_url
else
redirect_to @user
end
user = Factory(:user, :role => "admin")
visit new_user_session_path
fill_in "user_email", :with => user.email
fill_in "user_password", :with => "foobar"
click_button "Sign"
@krisf
krisf / gist:2344104
Created April 9, 2012 15:05
lol im a baddie
class ProfilesController < AuthorizedController
before_filter :extract_location, :only => :search
def search
search_terms = params[:profile].keep_if {|key, val| !val.blank? && val != '0'}
search_terms.each{|key, val| search_terms[key] = true if val == '1'}
if @location_params[:name]
@locations = Location.near(@location_params[:name], @location_params[:within], {:select => "locations.*, profiles.*", :units => :km}).joins(:profile).has_user_role.where(:profiles => search_terms)
current_hometown_filter_for_search(@locations)
profile_ids = @locations.map{|loc| loc.profile_id}.compact.uniq