Skip to content

Instantly share code, notes, and snippets.

View enricostano's full-sized avatar

Enrico Stano enricostano

View GitHub Profile
λ 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
var streamPair = require('stream-pair');
var Interactive = require('multistream-select').Interactive;
var Select = require('multistream-select').Select
var pair = streamPair.create();
var msi = new Interactive();
var mss = new Select()
mss.handle(pair.other);
@enricostano
enricostano / lib.rs
Last active December 3, 2015 16:54
use std::cmp::Ordering;
#[derive(Clone, Eq, PartialEq)]
struct Element {
weight: usize
}
impl Ord for Element {
fn cmp(&self, other: &Element) -> Ordering {
let ow = other.weight;
@enricostano
enricostano / main.rs
Last active October 21, 2015 10:56
Pipa
use std::io::{self, BufRead};
struct Item {
trigger: String,
value: String
}
impl Item {
fn new(trigger: String, value: String) -> Item {
Item { trigger: trigger, value: value }
# /etc/systemd/network/br0.netdev
[NetDev]
Name=br0
Kind=bridge
extern crate ncurses;
use std::fs::{self, ReadDir};
use std::path::Path;
use std::char;
use ncurses::*;
fn print_entries(dir: std::fs::ReadDir) {
for entry in dir {
match entry {