Skip to content

Instantly share code, notes, and snippets.

View vicatcu's full-sized avatar

Victor Aprea vicatcu

View GitHub Profile
@vicatcu
vicatcu / tftpd-hpa-cmd-fail
Created September 29, 2012 05:09
tftpd command fail
vic@VictorAsus:~$ /etc/init.d/tftpd-hpa restart
Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service tftpd-hpa restart
Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the stop(8) and then start(8) utilities,
e.g. stop tftpd-hpa ; start tftpd-hpa. The restart(8) utility is also available.
stop: Rejected send message, 1 matched rules; type="method_call", sender=":1.123" (uid=1000 pid=5383 comm="stop tftpd-hpa ") interface="com.ubuntu.Upstart0_6.Job" member="Stop" error name="(unset)" requested_reply="0" destination="com.ubuntu.Upstart" (uid=0 pid=1 comm="/sbin/init")
@vicatcu
vicatcu / daycounter_example.ino
Created October 31, 2013 16:32
displayTime function using 4 day chained counters
#include <DayCounter.h>
#include <ShiftRegister.h>
/* * * * * * * * * * * * * * * * * *
* pin 5 = DayCounter.SER (data) *
* pin 7 = DayCounter.CLK (clock) *
* pin 9 = DayCounter.RCK (latch) *
* * * * * * * * * * * * * * * * * */
DayCounter dc(5, 7, 9);
int count = 0;
*:80 is a NameVirtualHost
default server ithacagenerator.org (/etc/apache2/sites-enabled/000-default.conf:1)
port 80 namevhost ithacagenerator.org (/etc/apache2/sites-enabled/000-default.conf:1)
port 80 namevhost bugzilla.ithacagenerator.org (/etc/apache2/sites-enabled/bugzilla.ithacagenerator.org.conf:4)
alias bugzilla.ithacagenerator.is-very-nice.org
port 80 namevhost drupal.ithacagenerator.org (/etc/apache2/sites-enabled/drupal.ithacagenerator.org.conf:4)
alias drupal.ithacagenerator.is-very-nice.org
port 80 namevhost phpmyadmin.ithacagenerator.org (/etc/apache2/sites-enabled/phpmyadmin.ithacagenerator.org.conf:4)
alias phpmyadmin.ithacagenerator.is-very-nice.org
port 80 namevhost wiki.ithacagenerator.org (/etc/apache2/sites-enabled/wiki.ithacagenerator.org.conf:4)
#
# wiki.ithacagenerator.org (/etc/apache2/sites-available/wiki.ithacagenerator.org)
#
<VirtualHost *:80>
ServerAdmin webmaster@ithacagenerator.org
ServerName wiki.ithacagenerator.org
ServerAlias wiki.ithacagenerator.is-very-nice.org
# Indexes + Directory Root.
DirectoryIndex index.html
VirtualHost configuration:
*:80 is a NameVirtualHost
default server ithacagenerator.org (/etc/apache2/sites-enabled/000-default.conf:1)
port 80 namevhost ithacagenerator.org (/etc/apache2/sites-enabled/000-default.conf:1)
port 80 namevhost bugzilla.ithacagenerator.org (/etc/apache2/sites-enabled/bugzilla.ithacagenerator.org.conf:4)
alias bugzilla.ithacagenerator.is-very-nice.org
port 80 namevhost drupal.ithacagenerator.org (/etc/apache2/sites-enabled/drupal.ithacagenerator.org.conf:4)
alias drupal.ithacagenerator.is-very-nice.org
port 80 namevhost phpmyadmin.ithacagenerator.org (/etc/apache2/sites-enabled/phpmyadmin.ithacagenerator.org.conf:4)
alias phpmyadmin.ithacagenerator.is-very-nice.org
SPEC
describe "when a membeship is created" do
let!(:another_membership) { FactoryGirl.create(:membership, user: user, membership_type: membertype,
start: Date.parse("2013-11-15")) }
context "if there are other memberships associated with user" do
it "sets the end date for any of them that have a nil end date" do
expect(Membership.find_by(start: Date.parse("2012-11-15"))).not_to be_nil
require 'rails_helper'
RSpec.describe Membership, :type => :model do
let!(:user) { FactoryGirl.create(:user, gnucash_id: "FOO")}
let!(:membertype) { FactoryGirl.create(:membership_type, name: "BAR", monthlycost: 23)}
let!(:membership) { FactoryGirl.create(:membership, user: user, membership_type: membertype,
start: Date.parse("2012-11-15")) }
subject { membership }
Failures:
1) Membership when a membeship is created if there are other memberships associated with user sets the end date for any of them that have a nil end date
Failure/Error: expect(Membership.find_by(start: Date.parse("2012-11-15")).end).not_to be_nil
expected: not nil
got: nil
# ./spec/models/membership_spec.rb:35:in `block (4 levels) in <top (required)>'
def enforce_at_most_one_open_for_user
new_end_date = self.start.prev_day
if !self.user.nil?
self.user.memberships.each do |m|
if m.id != self.id && m.nil?
go.nil
m.end = new_end_date
m.save!
end