Skip to content

Instantly share code, notes, and snippets.

View safarista's full-sized avatar

Nelson Kelem safarista

View GitHub Profile
@safarista
safarista / error.sh
Last active December 16, 2015 13:39
Heroku and Spree uploads
the-crab$ heroku logs
2013-04-23T13:11:33.323270+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
2013-04-23T13:11:33.323270+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/transactions.rb:259:in `block in save'
2013-04-23T13:11:33.323485+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/abstract_controller/callbacks.rb:18:in `block in process_action'
2013-04-23T13:11:33.323485+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:405:in `__run_callback'
2013-04-23T13:11:33.323696+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_controller/metal/rescue.rb:29:in `process_action'
2013-04-23T13:11:33.323696+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/notifications.rb:123:in `block in instrument'
2013-04-23T13:11:33.323
@safarista
safarista / ssh_server_security.markdown
Last active December 16, 2015 09:28
Securing SSH on UBUNTU Server 12.04 on a VPS
  1. On the VPS. Setup a user in sudo group with sudo permissions
  • $ adduser deployer --ingroup sudo
  • NOTE: On Ubuntu >= -v11.0 the admin group was removed, the default is sudo
  1. On your local machine, install ssh-copy-id:
  • $ brew install ssh-copy-id
  1. Then, copy your ssh certificate onto your new slice form your local machine: enter password on prompt
  • $ ssh-copy-id deployer@IP_ADDRESS_OF_VPS
  1. After testing that you can ssh into your VPS, open the sshd_config file on your slice, to improve security:
  • $ sudo nano /etc/ssh/sshd_config
  1. The main things to change (or check) are:
@safarista
safarista / spree.rb
Last active December 16, 2015 05:29
Spree heroku paperclip configs
#initializers/spree.rb
Spree.config do |config|
# Example:
# Uncomment to override the default site name.
config.site_name = "Coffee Tailors"
# Amazon S3 Storage
config.use_s3 = false # if Rails.env.production?
config.s3_bucket = 'spree'
config.s3_access_key = "WTERTRTRYRYEYEU"
@safarista
safarista / spree_suppliers_multistore.md
Created April 8, 2013 21:51
spree_suppliers_multistore trial specs stories by @lbramos
Specifications ==== 1. What the super admin admin sees 2. What the store admin sees 3. What the buyer sees 4. What happens when you buy
@safarista
safarista / servers.md
Created January 16, 2013 13:40
Trying to install 4 servers all on an internal network reachable via VPN by clients as far between as London and Glasgow and in-between. What is the best solution for this. Any help please. Am daft at SysAdmin.

Requirements:

  • Ubuntu MAAS
  • Ubuntu Juju
  • Ruby
  • Ruby on Rails
  • Sinatra
  • Asterisk PBX
  • Free PBX
  • Spree Commerce Apps
@safarista
safarista / more_info.md
Last active December 10, 2015 09:29
A Spree Commerce challenge. Any suggestions how to tackle this?
  • Internet Shop

    • Status: The solution for this is a straight Spree Commerce solution and all Internet Orders are handled at the Warehouse.
  • Physical Shop

    • Propositions:
      • This one will need a more thoruogh reality check
      • Should work with current ePOS proccessing
      • This solution can be run locally/redunancy at the shop with continous central DB (located at Main Office) update for main office admin purposes.
    • Requirements:
  • We need to create staff roles. The staff sells to Customer without Customer logging in.

@safarista
safarista / hosts.md
Created December 29, 2012 18:24
How to edit the hosts file in Mac OS X 10.6 Snow Leopard to Mac OS X 10.6 10.8 Mountain Lion

The hosts file is a text file that maps hostnames to IP addresses. On browser request, the system first checks if there is an entry in the hosts file, if exists gets the corresponding IP address. If no it resolves the IP via the active connection’s DNS servers.

The hosts file can be edited to block certain hostsnames, like Adobe's licence hosts, or used for web development purposes, i.e. to redirect domains to local addresses.

###Steps – Open the Terminal.app

@safarista
safarista / rightmove.co.uk.rb
Last active December 10, 2015 08:38
How to scrap Rightmove Agents. Ill probably need Fax numbers and website addresses. Planning B
# encoding: UTF-8
# MIT LICENSE (c)2012 Nelson Kelem [nelson at ilinkoln.org]
# Date: 30/12/2012
# How to scrap Rightmove Agents
# Ill probably need Fax numbers and website addresses
# Planning B
# TODO: Write data to JSON, YAML or CSV
require 'nokogiri'
@safarista
safarista / domain_checker
Created September 3, 2012 19:27
Fast domain availability checker using bash
#!/bin/bash
# domainavailable
# Fast, domain name checker to use from the shell
# Use globs for real fun:
# domainavailable blah{1..3}.{com,net,org,co.uk}
# Inspired by foca / giles:
# http://gilesbowkett.blogspot.com/2009/02/simple-bash-domain-availability.html
trap 'exit 1' INT TERM EXIT
require "application_responder"
class ApplicationController < ActionController::Base
# ...
def self.acts_as_magical
around_filter :magic_new, :only => :new
around_filter :magic_show, :only => :show
around_filter :magic_edit, :only => :edit