This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# Display the colors available in a terminal. | |
for color in range(0, 256): | |
for i in range(0, 1): | |
print("\033[38;5;%sm%03s\033[m" % (str(color), str(color)), end=' ') | |
if color % 10 == 0: | |
print() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![feature(non_ascii_idents)] | |
use std::io::{Write, BufRead, BufReader}; | |
use std::process::exit; | |
use std::fs::File; | |
fn main() { | |
let args : Vec<_> = std::env::args().collect(); | |
if args.len() != 2 { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![feature(non_ascii_idents)] | |
fn main() { | |
std::env::args().nth(1) | |
.ok_or(format!("Usage: {} FILE", std::env::args().next().unwrap())) // File name | |
.and_then(|filename| { | |
std::fs::File::open(&filename) | |
.map_err(|e| (&e as &std::error::Error).description().to_string()) | |
}).map(|f| (f, String::new())) | |
.map(|(mut f, mut s)| ((&mut f as &mut std::io::Read).read_to_string(&mut s), s)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![feature(asm)] | |
#![feature(lang_items)] | |
#![crate_type = "staticlib"] | |
#![no_std] | |
const GPIO_BASE: u32 = 0x3F200000; // base address for Pi 2 and Pi 3 | |
fn sleep(value: u32){ | |
for _ in 1..value { | |
unsafe { asm!("");} |