Skip to content

Instantly share code, notes, and snippets.

View enricostano's full-sized avatar

Enrico Stano enricostano

View GitHub Profile
describe "DELETE #destroy" do
before(:each) do
@institution = mock_model(Institution)
should_authorize(:destroy, @institution)
Institution.should_receive(:find).with("1").and_return(@institution)
@institution.should_receive(:destroy).and_return(true)
get :destroy, id: "1"
end
it "assigns the requested institution to @institution" do
λ vagrant ssh
Welcome to Ubuntu 16.04.1 LTS (GNU/Linux 4.4.0-45-generic x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
Get cloud support with Ubuntu Advantage Cloud Guest:
http://www.ubuntu.com/business/services/cloud
[ 1150.568219] BUG: unable to handle kernel NULL pointer dereference at (null)
[ 1150.568240] IP: [<ffffffffa05260b4>] cfg80211_scan_done+0x34/0x110 [cfg80211]
[ 1150.568260] PGD 0
[ 1150.568265] Oops: 0000 [#1] PREEMPT SMP
[ 1150.568273] Modules linked in: tg3 ptp pps_core libphy btusb btrtl btbcm btintel bluetooth hid_generic input_leds joydev mousedev hid_apple usbhid hid bcm5974 bridge stp llc ipt_MASQUERADE nf_nat_masquerade_ipv4 iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack iptable_filter iTCO_wdt iTCO_vendor_support intel_rapl x86_pkg_temp_thermal intel_powerclamp coretemp wl(PO) kvm_intel kvm snd_hda_codec_hdmi snd_hda_codec_cirrus snd_hda_codec_generic irqbypass crct10dif_pclmul crc32_pclmul crc32c_intel ghash_clmulni_intel aesni_intel aes_x86_64 lrw applesmc gf128mul glue_helper led_class ablk_helper cryptd input_polldev intel_cstate snd_hda_intel snd_hda_codec intel_rapl_perf cfg80211 snd_hda_core snd_hwdep thunderbolt bdc_pci snd_pcm rfkill snd_timer mei_m
@enricostano
enricostano / shift_register.rs
Last active May 13, 2016 14:01
Playing with shift registers with Rust + ARMv7 + GPIO
extern crate sysfs_gpio;
use sysfs_gpio::{Direction,Pin};
use std::time::Duration;
use std::thread::sleep;
fn main() {
let data_pin = Pin::new(18); // SER #14
let latch_pin = Pin::new(23); // RCLK #12
let clock_pin = Pin::new(24); // SRCLK #11
HDMI:EDID version 1.3, 1 extensions, screen size 64x36 cm
HDMI:EDID features - videodef 0x80 !standby !suspend !active off; colour encoding:RGB444|YCbCr422; sRGB is not default colourspace; preferred format is native; does not support GTF
HDMI:EDID found monitor name descriptor tag 0xfc
HDMI:EDID monitor name is PHILIPS_FTV
HDMI:EDID found monitor range descriptor tag 0xfd
HDMI:EDID monitor range offsets: V min=0, V max=0, H min=0, H max=0
HDMI:EDID monitor range: vertical is 56-76 Hz, horizontal is 30-83 kHz, max pixel clock is 170 MHz
HDMI:EDID monitor range does not support GTF
HDMI:EDID found preferred CEA detail timing format: 1920x1080p @ 60 Hz (16)
HDMI:EDID failed to find a matching detail format for 1360x768p hfp:72 hs:136 hbp:208 vfp:3 vs:5 vbp:22 pixel clock:84 MHz
[moo@alarmpi ~]$ /opt/vc/bin/tvservice -n
device_name=PHL-PHILIPS_FTV
[moo@alarmpi ~]$ /opt/vc/bin/tvservice -s
state 0x12000a [HDMI CEA (16) RGB lim 16:9], 1920x1080 @ 60.00Hz, progressive
[moo@alarmpi ~]$ /opt/vc/bin/tvservice -M
Starting to monitor for HDMI events
[I] HDMI cable is unplugged
[I] HDMI is attached
[I] HDMI cable is unplugged
[I] HDMI is attached
@enricostano
enricostano / chef_vagrant
Created January 25, 2014 15:17
Chef on Vagrant VM
[2014-01-25T15:01:06+00:00] WARN: Cloning resource attributes for package[build-essential] from prior resource (CHEF-3694)
[2014-01-25T15:01:06+00:00] WARN: Previous package[build-essential]: /tmp/vagrant-chef/chef-solo-2/cookbooks/build-essential/recipes/debian.rb:40:in `block in from_file'
[2014-01-25T15:01:06+00:00] WARN: Current package[build-essential]: /tmp/vagrant-chef/chef-solo-2/cookbooks/rbenv/providers/ruby.rb:102:in `block in install_ruby_dependencies'
[2014-01-25T15:01:07+00:00] WARN: Cloning resource attributes for package[bison] from prior resource (CHEF-3694)
[2014-01-25T15:01:07+00:00] WARN: Previous package[bison]: /tmp/vagrant-chef/chef-solo-2/cookbooks/build-essential/recipes/debian.rb:40:in `block in from_file'
[2014-01-25T15:01:07+00:00] WARN: Current package[bison]: /tmp/vagrant-chef/chef-solo-2/cookbooks/rbenv/providers/ruby.rb:102:in `block in install_ruby_dependencies'
2.0.0p247 :001 > g = Group.first
Group Load (1.6ms) SELECT "groups".* FROM "groups" ORDER BY "groups"."id" ASC LIMIT 1
=> #<Group id: 1, name: "coope", created_at: "2013-12-06 17:37:56", updated_at: "2013-12-06 17:37:56">
2.0.0p247 :002 > g.as_json
=> {"id"=>1, "name"=>"coope", "created_at"=>Fri, 06 Dec 2013 17:37:56 UTC +00:00, "updated_at"=>Fri, 06 Dec 2013 17:37:56 UTC +00:00}
factory :user do
name "Jessie Pinkman"
email
password "secret"
password_confirmation "secret"
factory :group_admin, parent: :user do
ignore do
group = nil
end
$ java -jar /var/cache/jenkins/war/WEB-INF/jenkins-cli.jar -s http://ci.myhost.com:8080/ reload-configuration
[WARN] Failed to authenticate with your SSH keys. Proceeding as anonymous
hudson.security.AccessDeniedException2: anonymous is missing the Overall/Administer permission
at hudson.security.ACL.checkPermission(ACL.java:54)
at hudson.model.Node.checkPermission(Node.java:412)
at jenkins.model.Jenkins.doReload(Jenkins.java:3038)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)