Skip to content

Instantly share code, notes, and snippets.

View astamatto's full-sized avatar

Alessandro Stamatto astamatto

View GitHub Profile
fn main() {
println!("hello?");
}
/*
-- Running Windows --
Installed MinGW per tutorial (checking mingw32-base and msys-base)
Included minGW/bin on path
Still, error on compiling hello world:
@astamatto
astamatto / downloadOOTS.py
Created November 18, 2014 03:04
Mini-script that downloads all Order of The Stick comics!
import requests, os, bs4
os.makedirs("oots", exist_ok=True)
for i in range (1, 968):
comicUrl = "http://www.giantitp.com/comics/oots" + str(i).zfill(4) + ".html"
filename = os.path.join("oots", "oots" + str(i).zfill(4) + ".gif")
if os.path.exists(filename):
print ("Skipping ", comicUrl)
continue
use std::cmp::Ordering;
#[derive(Debug)]
pub struct Tree<T> (Option<Box<Node<T>>>);
#[derive(Debug)]
pub struct Node<T> {
elem: T,
left: Tree<T>,
right: Tree<T>,
use std::cmp::Ordering;
#[derive(Debug)]
pub struct Tree<T> (Option<Box<Node<T>>>);
#[derive(Debug)]
pub struct Node<T> {
elem: T,
left: Tree<T>,
right: Tree<T>,
pub fn other(&self, room: &Room) -> Rc<RefCell<Room>> {
match self.left.borrow().name { //name is a String in the Room Struct
ref name if name == room.name => self.right.clone(),
_ => self.left.clone()
}
}
/* Gives:
the trait bound `&std::string::String: std::cmp::PartialEq<std::string::String>` is not satisfied [E0277]
src\game\hall.rs:20 ref name if name == room.name => self.right.clone(),
let h: &Vec<Json> = try!(h.as_array().ok_or("Unable to parse halls".to_string()));
if h.len() != 2 { return Err("Invalid number of rooms per hall".to_string()); }
let left = h[0].as_u64().ok_or("Unable to parse Hall left".to_string());
let right = h[0].as_u64().ok_or("Unable to parse Hall left".to_string());
let mut hall = Hall::new_left_right(&self.rooms[left as usize], &self.rooms[right as usize]);
#include <iostream>
#include <cctype>
using namespace std;
int main () {
char a;
int x = 0;
cin >> noskipws;
import fileinput
def resolver():
for line in fileinput.input():
x = 0
for c in line:
print(c.upper() if x % 2 == 0 else c.lower(), end='')
if c != ' ':
x += 1
import sys
def resolver():
entrada = sys.stdin.read()
saida = list(entrada)
x = 0
for i, c in enumerate(entrada):
if c == '\n':
x = 0
elif c != ' ':
#include <stdio.h>
int main () {
double a, b;
int i = 1;
while (scanf("%lf %lf", &a, &b) == 2)
printf ("Projeto %d:\n"
"Percentual dos juros da aplicacao: %.2lf %% \n",