Skip to content

Instantly share code, notes, and snippets.

#!/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()
@siiky
siiky / main.rs
Created January 8, 2017 03:09 — forked from anonymous/main.rs
#![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 {
@siiky
siiky / main.rs
Created January 8, 2017 03:09 — forked from anonymous/main.rs
#![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))
@siiky
siiky / rpi3_rust_led.rs
Created January 12, 2017 02:58 — forked from undefinedbehavior/rpi3_rust_led.rs
Rust demo for Pi 3 bare metal
#![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!("");}