Skip to content

Instantly share code, notes, and snippets.

View itarato's full-sized avatar

Peter Arato itarato

  • Montreal, Canada
  • 04:52 (UTC -04:00)
View GitHub Profile
@itarato
itarato / LondonTime.swift
Created August 6, 2015 08:15
Easy London time menu bar item for OS-X in Swift 2.
import Cocoa
@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {
var statusItem:NSStatusItem!
var timer:NSTimer!
func applicationDidFinishLaunching(aNotification: NSNotification) {
let statusBar = NSStatusBar.systemStatusBar()
@itarato
itarato / Genetic.py
Created August 13, 2015 07:40
Sort of genetic algorithm for an imaginary consumption-waste cycle process
import random
import Journey
import copy
__pool_size__ = 90
__survival_limit__ = 30
__mutation_rate__ = 5
@itarato
itarato / TicTacToe.py
Created August 19, 2015 06:25
2 player (human + AI) Tic Tac Toe using Minimax
class Player():
def __init__(self): pass
def move(self, player_bit, game_map, evaluator): pass
class STDIOPlayer(Player):
def move(self, player_bit, game_map, evaluator):
idx = input('Your step (0-9): ')
game_map[int(idx)] = player_bit
@itarato
itarato / unblovckme_lvl_605.go
Created September 19, 2015 03:41
Unblock Me iOS game level 605 solver
package main
import (
"log"
"math/rand"
)
const MOVE_VERTICALLY = true
const MOVE_HORIZONTALLY = !MOVE_VERTICALLY
const MOVE_UPLEFT = -1
@itarato
itarato / alt_crawler.go
Last active September 23, 2015 15:22
Website crawler looking for missing IMG tag ALT attributes on all linked pages (recursively)
package main
import (
"errors"
"io/ioutil"
"log"
"net/http"
"net/url"
"regexp"
"strconv"
@itarato
itarato / antisubmodule.md
Created November 23, 2015 14:06
Workaround to have a version controlled project in another where git submodule is not allowed

Anti-submodule workaround

Workaround to have a version controlled project in another where git submodule is not allowed. This toggles the git files.

Into global gitignore

**/hide.git
**/hide.gitignore
@itarato
itarato / broken_image.md
Last active December 8, 2015 10:15
Broken image after database clone

Broken images after DB clone

Get a broken image replacement, such as this placeholder and save it to your webserver (available on the same domain).

Add the following entry to Apache (virtual host or .htaccess file):

<IfModule mod_rewrite.c>
 RewriteEngine on
@itarato
itarato / 240easy.rs
Created December 15, 2015 07:37
Typoglycemia on dailyprogrammer 240 easy.
use std::fs::File;
use std::io::Read;
use rand::Rng;
extern crate rand;
fn main() {
let mut f = File::open("/Users/itarato/Documents/Rust/240.in").unwrap();
let mut content: String = String::new();
f.read_to_string(&mut content).ok().expect("Cannot read input");
@itarato
itarato / 242easy.rs
Created December 15, 2015 08:39
Feeding people with fruit from dailyprogrammer 242 easy.
use std::fmt;
struct Plant {
age: u32,
}
struct Garden {
plants: Vec<Plant>,
fruit: u32,
}
@itarato
itarato / graphs.rs
Created December 21, 2015 04:23
Play with graph representations and Rust reference models.
use std::fs::File;
use std::io::Read;
use std::rc::Rc;
use std::cell::RefCell;
use std::collections::HashMap;
use std::default::Default;
use std::string::String;
use std::fmt;
#[derive(Debug)]