Skip to content

Instantly share code, notes, and snippets.

View sajattack's full-sized avatar

Paul Sajna sajattack

View GitHub Profile
@sajattack
sajattack / serial.rs
Created February 18, 2019 13:20
bitbang uart rx
impl <TX, RX, Delay> serial::Read<u8> for Serial <TX, RX, Delay>
where
TX: OutputPin,
RX: InputPin,
Delay: DelayUs<u32>
{
type Error = ();
fn read(&mut self) -> nb::Result<u8, Self::Error> {
@sajattack
sajattack / error_log.txt
Created February 6, 2019 19:18
celeste crash
Celeste Error Log
==========================================
Ver 1.2.6.1
02/06/2019 11:10:35
System.Exception: FMOD Failed: ERR_OUTPUT_INIT
at Celeste.Audio.CheckFmod (FMOD.RESULT result) [0x00019] in <e6396995e64e4637a8dd70ee94d7253d>:0
at Celeste.Audio.Init () [0x00039] in <e6396995e64e4637a8dd70ee94d7253d>:0
at Celeste.GameLoader.LoadThread () [0x0002b] in <e6396995e64e4637a8dd70ee94d7253d>:0
at Celeste.RunThread.RunThreadWithLogging (System.Action method) [0x00002] in <e6396995e64e4637a8dd70ee94d7253d>:0
#[path = "../../utils.rs"]
mod utils;
use crate::utils::*;
use std::boxed::Box;
use std::collections::HashMap;
fn main() {
let input: String = get_input(6).expect("Failed to retrieve input");
@sajattack
sajattack / dma.c
Last active November 5, 2018 19:16
ASF4 DMA Library for SAM0
/*
* \file
*
* \brief SAM Direct Memory Access Controller Driver
*
* Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.
*
* \asf_license_start
*
* \page License
@sajattack
sajattack / swap.sh
Last active October 15, 2018 06:25
fallocate -l 1G /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
echo '/swapfile none swap sw 0 0' >> /etc/fstab
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by TiMidity++ configure 2.14.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ ./configure --host=x86_64-unknown-redox --prefix=
## --------- ##
## Platform. ##
extern "C" {
pub fn access(arg1: *const libc::c_char,
arg2: libc::c_int) -> libc::c_int;
}
extern "C" {
pub fn alarm(arg1: libc::c_uint) -> libc::c_uint;
}
extern "C" {
pub fn brk(arg1: *mut libc::c_void) -> libc::c_int;
}
.C:0810 00 BRK
.C:0811 28 PLP
.C:0812 50 78 BVC $088C
.C:0814 A0 C8 LDY #$C8
.C:0816 F0 18 BEQ $0830
.C:0818 40 RTI
.C:0819 68 PLA
.C:081a 90 B8 BCC $07D4
.C:081c E0 08 CPX #$08
.C:081e 30 58 BMI $0878
unsafe fn lookup_addr(addr: *const in_addr) -> Result<LookupAddr> {
// XXX better error handling
let ip_string = String::from_utf8(::file_read_all("/etc/net/ip")?).or(Err(
Error::new(syscall::EIO),
))?;
let ip: Vec<u8> = ip_string
.trim()
.split(".")
.map(|part| part.parse::<u8>().unwrap_or(0))
.collect();
libc_fn!(unsafe getprotoent() -> Result <*const protoent> {
if protodb == 0 {
protodb = syscall::open("/etc/protocols", syscall::O_RDONLY).unwrap();
LINE = RawLineBuffer::new(protodb);
}
let mut r = match LINE.next() {
Some(Ok(s)) => s,
Some(Err(_)) => panic!(),
None => panic!()