Skip to content

Instantly share code, notes, and snippets.

@jgautsch
jgautsch / 20131022143445_add_subject_to_if_report.rb
Last active December 26, 2015 05:59
A migration that is stalling
# This one worked just fine 20 minutes ago. Nothing has changed since then.
class AddSubjectToIfReport < ActiveRecord::Migration
def change
add_column :if_reports, :subject, :text
end
end
@jgautsch
jgautsch / application.rb
Created October 21, 2013 15:58
Acting like production. Caching everything, not reloading anything
require File.expand_path('../boot', __FILE__)
require 'rails/all'
if defined?(Bundler)
# If you precompile assets before deploying to production, use this line
Bundler.require(*Rails.groups(:assets => %w(development test)))
# If you want your assets lazily compiled in production, use this line
# Bundler.require(:default, :assets, Rails.env)
end
@jgautsch
jgautsch / wtf.c
Created October 3, 2013 06:22
sending name to ftp server
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Interacting with server
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
char *file_name = argv[3];
/* First send the length of the file name */
short int file_name_length = strlen(file_name);
if (send(sock, &file_name_length, sizeof(file_name_length), 0) <= 0)
DieWithError("send() sent a different number of bytes than expected");
@jgautsch
jgautsch / simple_udp_server.rb
Created September 10, 2013 04:41
A simple UDP server that will receive some text, reverse it and send that as a response. Runs locally on port 1234 (127.0.0.1:1234)
require 'socket'
require 'pp'
host = 'localhost'
port = 1234
s = UDPSocket.new
s.bind(nil, port)
while 1 do
@jgautsch
jgautsch / _.md
Created August 20, 2013 19:58
[dot enter: 09] move along
@jgautsch
jgautsch / _.md
Created August 20, 2013 19:40
[dot enter: 08] movetofront
@jgautsch
jgautsch / _.md
Created August 20, 2013 19:35
[dot enter: 07] stacks
@jgautsch
jgautsch / _.md
Created August 20, 2013 19:09
[dot append: 06] simple transition
@jgautsch
jgautsch / _.md
Created August 20, 2013 18:07
[dot append: 03] electron
@jgautsch
jgautsch / gist:6225904
Created August 13, 2013 21:32
Capistrano asset compilation problem
* 2013-08-13 16:25:28 executing `deploy:assets:precompile'
triggering before callbacks for `deploy:assets:precompile'
* 2013-08-13 16:25:28 executing `deploy:assets:update_asset_mtimes'
* executing "[ -e /mnt/workmein-production/shared/assets/manifest* ] && cat /mnt/workmein-production/shared/assets/manifest* || echo"
servers: ["production.foo.com"]
[production.foo.com] executing command
command finished in 147ms
* 2013-08-13 16:25:28 executing `deploy:assets:symlink'
* executing "rm -rf /mnt/workmein-production/releases/20130813212515/public/assets && mkdir -p /mnt/workmein-production/releases/20130813212515/public && mkdir -p /mnt/workmein-production/shared/assets && ln -s /mnt/workmein-production/shared/assets /mnt/workmein-production/releases/20130813212515/public/assets"
servers: ["production.foo.com"]