Skip to content

Instantly share code, notes, and snippets.

View itarato's full-sized avatar

Peter Arato itarato

  • Montreal, Canada
View GitHub Profile
@itarato
itarato / encryption.java
Created September 28, 2014 18:59
Java AES CBC encryption example
package com.company;
import javax.crypto.Cipher;
import javax.crypto.Mac;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import java.security.MessageDigest;
import java.security.SecureRandom;
public class Main {
@itarato
itarato / ttymindmap.rb
Created March 7, 2017 04:18
Command line mindmap app
# Usage:
# - Start new mindmap:
# `ruby ttymindmap.rb`
# - Open Freemind format MM mindmap:
# `ruby ttymindmap.rb <PATH-TO-MM-FILE>`
#
# Press `h` key when running for help.
require 'nokogiri'
@itarato
itarato / hilbert_space_filling_curve.png
Last active May 2, 2022 01:30
Turtle-ish drawing with Python
hilbert_space_filling_curve.png
@itarato
itarato / asm.hs
Last active April 25, 2022 01:50
ASM interpreter in Haskell
import Control.Monad.State
import Data.Foldable
import Text.Read
import Control.Applicative
import System.IO
data Regs = Regs {
ax::Int,
cx::Int,
dx::Int,
@itarato
itarato / Doxygen
Created May 1, 2015 14:23
Doxygen example for PHP code
# Doxyfile 1.8.9
#---------------------------------------------------------------------------
# Project related configuration options
#---------------------------------------------------------------------------
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = "Cameron & Wilding Tool"
PROJECT_NUMBER =
PROJECT_BRIEF = "Drupal 7 Architecture tool"
PROJECT_LOGO = /Users/itarato/Desktop/logo.png
@itarato
itarato / parser_combinator.rb
Last active February 28, 2021 06:14
Parser combinator trial
require 'pp'
require "test/unit"
class String
def parse_response
ParseResponse.new(self)
end
def token
for_tokens(self)
@itarato
itarato / data_def.rb
Last active November 5, 2020 03:35
Playing with (almost) algebraic data definitions in Ruby
class Def
class DataContainer
def initialize(name)
@name = name
@members = []
@last_constructor = nil
Object.const_set(name, self)
end
@itarato
itarato / migrate_feature.rs
Last active June 14, 2020 02:01
Feature migration framework brainstorm
use std::cell::{RefCell};
/****************************************
* Abstractions
*/
trait Task {
fn get_name(&self) -> String;
fn get_description(&self) -> String;
fn is_complete(&self) -> bool;
@itarato
itarato / bigint.cpp
Created September 15, 2016 05:11
Simple C++ big integer class
#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
using namespace std;
#define GROUP_DEC_SIZE 4
class BigInt {
private:
@itarato
itarato / game_of_life.c
Created December 6, 2019 23:17
Game of Life (in C/SDL)
#include "SDL.h"
#include <stdint.h>
#include <stdbool.h>
#include <stdlib.h>
#include <unistd.h>
#include <time.h>
#define SIZE 1000
struct cell {