Skip to content

Instantly share code, notes, and snippets.

View mdarby's full-sized avatar
💭
pending validation

Matt Darby mdarby

💭
pending validation
View GitHub Profile
# latitude and longitude as strings is not ideal
@mdarby
mdarby / update.rb
Last active October 10, 2018 18:43
# frozen_string_literal: true
class ListingDescriptionUpdater
class << self
def update
file = ''
# Commented out the array of Place, Event, Job because Events and Jobs are required to have descriptions at point of creation so there should not be anything needed to be scraped from a site.
# If in the future the description field is no longer a required field they can be added back as shown below.
# [Place, Event, Job].each do |klass|
[Place].each do |klass|
@mdarby
mdarby / config_puma.rb
Created August 15, 2016 18:01 — forked from acrookston/config_puma.rb
puma config for rvm, capistrano 3 and upstart. Tested on Ubuntu 12.04 LTS and 14.04 LTS
#!/usr/bin/env puma
app_path = '/var/www/YOUR_APP_NAME/current'
directory app_path
environment 'production'
daemonize true
pidfile "#{app_path}/tmp/pids/puma.pid"
state_path "#{app_path}/tmp/pids/puma.state"
stdout_redirect "#{app_path}/log/puma_error.log", "#{app_path}/log/puma_access.log", true
threads 0,16
  1. On Rackspace Public Cloud, create an 8GB General Server with Ubuntu 14.04 PVHM.
  2. SSH in as root. If you are really cool, use tmux at this time.
  3. Install OpenStack Liberty
    bash <(curl -s https://raw.githubusercontent.com/openstack/openstack-ansible/liberty/scripts/run-aio-build.sh)
    
  4. Once complete, you can find the admin password in /root/openrc. Save it for later to log into Horizon.
  5. Fix the neutron endpoint to work with the SDK:
  6. lxc-ls | grep utility.
  7. lxc-attach -n aio1_utility_container-XXX. Replace XXX with the name you found in the last step.
@mdarby
mdarby / gist:552f38c1f46917159a83
Created June 30, 2015 20:57
DevStack install
sudo apt-get update
sudo apt-get install libffi-dev libssl-dev git vim build-essential python -y
git clone https://github.com/openstack-dev/devstack.git
sudo ./devstack/tools/create-stack-user.sh
sudo mv devstack/ /opt/stack/
rm -rf barbican/
chown -R stack:stack /opt/stack/devstack/
su - stack
cd /opt/stack/devstack/
@mdarby
mdarby / whoa.ex
Last active August 29, 2015 14:17
jobs
|> Enum.map(fn(x) -> x.name end)
|> Enum.sort
|> Enum.chunk(5)
|> Enum.map(fn(x) -> Enum.shuffle(x) end)
# (A) is != to (B)
names = Enum.map(jobs, fn(x) -> x.name end)
sorted_names = Enum.sort(names)
Server Software:
Server Hostname: localhost
Server Port: 4001
Document Path: /api/contacts
Document Length: 2 bytes
Concurrency Level: 100
Time taken for tests: 5.029 seconds
Complete requests: 10000
# They do different things. exec replaces the current process with the new process.
# system invokes another process and returns its exit value to the current process.
# backticks invokes another process and returns the output of that process to the current process.
while true
puts `bundle exec rspec 'spec/dev_free_ipad_idempotent_spec.rb'`
end
@mdarby
mdarby / gist:1acc75cbc2d23d6c97b5
Created September 21, 2014 04:35
POST to localhost:8080/change with {given: 1000, owed: 450} and receive a JSON response of the change due in standard US currency. Some DRYing should occur around the Denominations.
package main
import (
"encoding/json"
"io"
"log"
"net/http"
"strconv"
)
package main
import (
"errors"
"html/template"
"io/ioutil"
"net/http"
"regexp"
)