Skip to content

Instantly share code, notes, and snippets.

View damien's full-sized avatar
🤝
Open for business! Hire me for your project at https://mindglob.com

Damien Wilson damien

🤝
Open for business! Hire me for your project at https://mindglob.com
View GitHub Profile
vagrant@salt-master:~$ ps -efl|egrep salt-master
1 S root 6247 1 0 80 0 - 114799 poll_s 18:16 ? 00:00:00 /usr/bin/python /usr/bin/salt-master
1 S root 6249 1 0 80 0 - 114181 poll_s 18:16 ? 00:00:00 /usr/bin/python /usr/bin/salt-master
1 S root 6250 1 0 80 0 - 114181 poll_s 18:16 ? 00:00:00 /usr/bin/python /usr/bin/salt-master
1 S root 6253 1 0 80 0 - 114179 poll_s 18:16 ? 00:00:00 /usr/bin/python /usr/bin/salt-master
4 S root 6300 1 0 80 0 - 127915 poll_s 18:16 ? 00:00:00 /usr/bin/python /usr/bin/salt-master
1 S root 6311 6300 0 80 0 - 71406 pipe_w 18:16 ? 00:00:00 /usr/bin/python /usr/bin/salt-master
1 S root 6318 6300 0 80 0 - 62379 poll_s 18:16 ? 00:00:00 /usr/bin/python /usr/bin/salt-master
1 S root 6319 6300 0 80 0 - 62379 poll_s 18:16 ? 00:00:00 /usr/bin/python /usr/bin/salt-master
1 S root 6326 6300 0 80 0 - 191654 poll_s 18:16 ? 00:00:00 /usr
@damien
damien / sql_query.sql
Last active December 19, 2015 10:09
This SQL query isn't working. :(
SELECT DISTINCT "posts".*
FROM "posts"
INNER JOIN memberships ON posts.group_id = memberships.group_id
WHERE (("posts"."published" = 't'
AND "memberships"."user_id" = 17403
OR "posts"."published" = 't'
AND "posts"."user_id" = 17403))
ORDER BY COALESCE(posts.liked_at, posts.updated_at, posts.created_at) DESC LIMIT 20
OFFSET 0
@damien
damien / Gemfile
Last active December 17, 2015 11:19
Strange IO errors that occur when I attempt to post multipart form data containing an image to a rails app running under Trinidad.
source 'https://rubygems.org'
# Requred for deployment with Trinidad
gem 'bundler'
gem 'rails', '3.2.13'
gem 'activeadmin'
gem 'activerecord-postgres-hstore' # PostgreSQL HStore support for ActiveRecord
gem 'airbrake' # using errbit, see config/errbit.rb
@damien
damien / jquery.serializeObject.js
Created March 4, 2013 05:01
Serialize Object plugin for jQuery. When used on a jQuery element containing a form, this plugin returns an object representation of the given form's data.
// Serialize a form into an object
// Credit goes to Tobias Cohen
// http://stackoverflow.com/a/1186309/51947
$.fn.serializeObject = function() {
var o = {};
var a = this.serializeArray();
$.each(a, function() {
if (o[this.name] !== undefined) {
if (!o[this.name].push) {
@damien
damien / stacktrace..txt
Created December 15, 2012 05:05
Null pointer exception from FTB
[21:00:13] LaunchFrame.main:141: FTBLaunch starting up (version 1.1.4)
[21:00:13] LaunchFrame.main:142: Java version: 1.7.0_01
[21:00:13] LaunchFrame.main:143: Java vendor: Oracle Corporation
[21:00:13] LaunchFrame.main:144: Java home: C:\Program Files\Java\jre7
[21:00:13] LaunchFrame.main:145: Java specification: Java Virtual Machine Specification version: 1.7 by Oracle Corporation
[21:00:13] LaunchFrame.main:147: Java vm: Java HotSpot(TM) 64-Bit Server VM version: 21.1-b02 by Oracle Corporation
[21:00:13] LaunchFrame.main:149: OS: amd64 Windows 7 6.1
[21:00:13] LocaleUpdater.checkForUpdates:46: [i18n] Checking for updates ...
[21:00:13] DownloadUtils.getStaticCreeperhostLink:95: http://repo.creeperhost.net/static/FTB2/locales
[21:00:14] LocaleUpdater.checkForUpdates:61: [i18n] remoteVer = 9
@damien
damien / filler.lua
Created October 25, 2012 06:11
A small collection of ComputerCraft Lua scripts
-- fill: fills a hole with whatever materials are on hand
--
-- The turtle will fill the first hole it runs into with the
-- materials on hand. When it runs out of materials to use
-- as filler, the turtle will return to where it was launched
-- and attempt to pick up more things to fill the hole with.
--
-- The turtle will return to where it was launched from
-- as soon as there is nothing left to fill or if there
-- are no available materials to fill the hole with.
@damien
damien / concerns-messagable_with_data.rb
Created July 12, 2012 23:06
Extending Mailboxer through Concerns
module Concerns
module MessagableWithData
extend ActiveSupport::Concern
included do
Message.class_eval do
has_many :message_data,
class_name: MessageData,
email_verification = CompanyEmailVerification.find_or_initialize_by_company_id_and_user_id(
user_id: current_user.id,
company_id: params[:id].to_s
)
if email_verification.persisted?
email_verification.send_verification_email
return render json: { success: true }
end
@damien
damien / records_to_urls.rb
Created March 21, 2012 18:32
Collect records and save them as a list of URLs from within the rails console.
target = URI.parse("http://www.your-host.org")
petitions = Petition.select([:id, :slug]).limit(10)
urls = petitions.map { |p| app.url_for(:subdomain=>"www", :action=>"show", :controller=>"petitions", :host => target.host, :id => p.slug) }
File.open('urls.txt') { |io| urls.each { |u| io.puts u } }
@damien
damien / gist:2130002
Created March 20, 2012 02:02
script gem segfault
/Users/damien/.rvm/gems/ruby-1.9.3-p125/gems/scrypt-1.0.3/lib/scrypt.rb:33: [BUG] Segmentation fault
ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-darwin11.3.0]
-- Control frame information -----------------------------------------------
c:0034 p:---- s:0154 b:0154 l:000153 d:000153 CFUNC :__sc_crypt
c:0033 p:0077 s:0148 b:0146 l:000145 d:000145 METHOD /Users/damien/.rvm/gems/ruby-1.9.3-p125/gems/scrypt-1.0.3/lib/scrypt.rb:33
c:0032 p:0032 s:0140 b:0140 l:000139 d:000139 METHOD /Users/damien/Fun/devise/lib/devise/encryptors/scrypt.rb:12
c:0031 p:0049 s:0133 b:0133 l:001dc8 d:000132 LAMBDA /Users/damien/Fun/devise/test/encryptors_test.rb:8
c:0030 p:---- s:0127 b:0127 l:000126 d:000126 FINISH
c:0029 p:0102 s:0125 b:0125 l:002198 d:002198 METHOD /Users/damien/.rvm/gems/ruby-1.9.3-p125/gems/mocha-0.10.0/lib/mocha/integration/mini_test/version_230_to_251.rb:28