Skip to content

Instantly share code, notes, and snippets.

View plainprogrammer's full-sized avatar

James Thompson plainprogrammer

View GitHub Profile
@plainprogrammer
plainprogrammer / S3 bulk rename script
Created July 3, 2012 18:13
This is a quick script for doing a mass copy or rename of all files in an Amazon S3 bucket.
# This is a quick script for doing a mass rename of all files in an Amazon S3 bucket.
# In this case, the rename operation was to unescape all filenames which had been
# previously escaped in error.
#############################
# Configuration:
bucketname = "YOUR_S3_BUCKET_NAME"
access_key = 'YOUR_ACCESS_KEY_ID'
secret_key = 'YOUR_SECRET_ACCESS_KEY'
@plainprogrammer
plainprogrammer / readyproject-soa-template.rb
Created November 19, 2012 21:48
The Ready Project Ruby Application Templates
require 'rvm'
rvm_env = RVM::Environment.new("jruby")
rvm_env.gemset_create(app_name)
rvm_env.gemset_use!(app_name)
create_file ".rvmrc", "rvm use jruby@trpsoa-#{app_name} --create"
run "rm README.rdoc"
run "rm doc/README_FOR_APP"
@plainprogrammer
plainprogrammer / scary_service.rb
Last active October 28, 2015 18:02
Scary Reorder Service
module Services
module Column
class Reorder
attr_reader :column_to_move, :column_before, :column_set
def initialize(column_to_move_id, column_before_id = nil)
@column_to_move = ::Column.find(column_to_move_id)
@column_before = ::Column.find(column_before_id) if column_before_id.present?
@column_set = @column_to_move.column_set
end
current_user = User.where(full_name: "Jane Fonda").first
current_user.connections.where("full_name LIKE ?", "%bus%").select(:id, :full_name)
#
# User Load (0.6ms)
# SELECT `users`.`id`, `users`.`full_name` FROM `users`
# INNER JOIN `contacts` ON `users`.`id` = `contacts`.`connection_id`
# WHERE `contacts`.`user_id` = 980204181
# AND (full_name LIKE '%bus%')
#
# => #<ActiveRecord::AssociationRelation [
@plainprogrammer
plainprogrammer / .bash_profile
Last active December 10, 2015 05:08
Custom BASH prompt including username, working directory, git branch and status on one line; followed by a simple prompt that reflects the exit status of the last command.
source /usr/local/etc/bash_completion.d/git-prompt.sh
function parse_git_dirty {
local retval=$?
[[ $(git status 2> /dev/null | tail -n1) != "" && $(git status 2> /dev/null | tail -n1) != "nothing to commit, working directory clean" ]] && echo "*"
return $retval
}
function parse_git_branch {
local retval=$?
@plainprogrammer
plainprogrammer / README.md
Created January 27, 2014 17:09
FoundationDB Sandbox in Vagrant (Virtualbox and VMware)

FoundationDB Sandbox

The provided Vagrant file and BASH provisioning script will setup a Precise 64 environment with version 1.0.1 of FoundationDB installed and ready to go.

@plainprogrammer
plainprogrammer / README.md
Created January 27, 2014 17:17
FoundationDB Sandbox with RVM in Vagrant (Virtualbox and VMware)

FoundationDB Sandbox

The provided Vagrant file and BASH provisioning script will setup a Precise 64 environment with version 1.0.1 of FoundationDB installed and ready to go, along with a working RVM environment.

Requirements

The Vagrantfile expects the vagrant-exec plugin to be present.

#!/usr/bin/ruby
rev_10_file = File.open('rev_10.rev', 'a')
rev_172_file = File.new('rev_172.txt', 'w+')
rev_192_file = File.new("rev_192.txt", "w+")
Dir['/Users/andybaxter/bind/*.com'].each do |filename|
File.open(filename, 'r+').readlines.each do |line|
domain = line.split.first
ip = line.split.last

Vineyard charter school under state scrutiny

Braley Dodson Daily Herald 17 hrs ago

The State Charter School Board, part of the Utah State Board of Education, did not take any action on closing a charter school Friday evening after concerns of student safety were brought forward.

The state charter board met to consider taking action on Franklin Discovery Academy in Vineyard, which opened Aug. 22 and teaches about 500 students in kindergarten through sixth grade. However, the board was ultimately unable to act on the matter because it did not issue a notice for the meeting 24 hours in advance.

The board has scheduled a meeting for 7 p.m. Saturday where possible action could be taken, which could include giving the school a warning, putting it on probation, allowing another entity to take over the school or voting to terminate the school.

Keybase proof

I hereby claim:

  • I am plainprogrammer on github.
  • I am plainprogrammer (https://keybase.io/plainprogrammer) on keybase.
  • I have a public key ASBc2-7Zt54OhRy1XbbESbRzPIL36TuAmOryyeOo58WWiwo

To claim this, I am signing this object: