Skip to content

Instantly share code, notes, and snippets.

View alexmullins's full-sized avatar

Alex Mullins alexmullins

View GitHub Profile
use std::io::{Read, Write, Seek};
// Driver is the basis for reading and writing words
// for use in the filesystem.
trait Driver {
fn erase_sector(&self, n: u32) -> Result<(), &'static str>;
fn erase_all_sectors(&self) -> Result<(), &'static str>;
fn read_word(&self, addr: u32) -> Result<u16, &'static str>;
fn write_word(&self, addr: u32, val: u16) -> Result<(), &'static str>;
}
@alexmullins
alexmullins / kernel_panic.txt
Last active March 28, 2017 02:48
kernel panic trying to unload univ-bbgw with "echo -5 > $SLOTS"
root@beaglebone:/sys/class/pwm/pwmchip0/pwm1# cat $SLOTS
0: PF---- -1
1: PF---- -1
2: PF---- -1
3: PF---- -1
4: P-O-L- 0 Override Board Name,00A0,Override Manuf,BB-PWM1
5: P-O-L- 1 Override Board Name,00A0,Override Manuf,univ-bbgw
root@beaglebone:/sys/class/pwm/pwmchip0/pwm1# echo -4 > $SLOTS
root@beaglebone:/sys/class/pwm/pwmchip0/pwm1# cat $SLOTS
0: PF---- -1

Keybase proof

I hereby claim:

  • I am alexmullins on github.
  • I am alexmullins (https://keybase.io/alexmullins) on keybase.
  • I have a public key ASB39u6jRcIe8U-NeyIg8y1ZX5BNz-TI8JuChAFhyZHLUAo

To claim this, I am signing this object:

@alexmullins
alexmullins / Test.java
Last active September 23, 2015 04:12
Example shows the difference between ++d and d++ operators.
package test;
public class Test {
// Example showing the difference between pre-increment (++i) and post-increment (i++) operators.
public static void main(String[] args) {
int d = 0;
// d++ is post-increment op
int e = d++; // What is the value of d and e after this line executes? It is d == 1 and e == 0
if (e == 0) {
System.out.println("d++ will first return the current value of d (which is 0) and assign it to e, then it will increment d to 1.");
@alexmullins
alexmullins / main.go
Last active January 17, 2023 09:49
Goquery Remove Child Elements
// Stackoverflow Answer
// Original Question: http://stackoverflow.com/questions/32635943/get-text-from-div-without-child-elements/32640258#32640258
package main
import (
"fmt"
"strings"
"github.com/PuerkitoBio/goquery"
@alexmullins
alexmullins / main.go
Last active March 17, 2024 07:26
Concurrent io.MultiWriter Implementation
package main
import (
"crypto/md5"
"crypto/sha1"
"crypto/sha256"
"crypto/sha512"
"encoding/hex"
"fmt"
"io"