Skip to content

Instantly share code, notes, and snippets.

View anroots's full-sized avatar

Ando David Roots anroots

View GitHub Profile
@anroots
anroots / Hasher.java
Created May 11, 2012 01:44
A graphical Java program that calculates the MD5 has of it's input.
import java.awt.*;
import java.awt.event.*;
import java.security.*;
import java.math.*;
/**
* A graphical Java program that calculates the MD5 has of it's input.
* @author anroots
*
*/
@anroots
anroots / itk-downloader.sh
Created May 11, 2012 01:49
Download ITK student images
#!/bin/bash
kasutajanimi=foobar # User
salasona=foobar # Pass
kaust="itk-pic" # Folder name
min_pic_id="440" # Min pic ID
max_pic_id="1000" # Max pic ID
wget --user-agent "ITK Notifier" --no-check-certificate --keep-session-cookies --save-cookies cookies.txt
--post-data="username=$kasutajanimi&pw=$salasona&Login=Logi sisse" https://itcollege.ois.ee/auth/login -O login
for i in `seq $min_pic_id $max_pic_id`;
@anroots
anroots / Stuffy.java
Created May 11, 2012 01:50
Converts a file of English text into Pig Latin.
import java.util.*;
import java.io.*;
/*
* Converts a file of English text into Pig Latin.
* @author Ando Roots 2011
*/
public class Stuffy {
/*
@anroots
anroots / messente.py
Created May 11, 2012 01:54
A script to send SMS messages using Messente API
# -*- coding: utf-8 -*-
#!/usr/bin/python -tt
# A script to send SMS messages using Messente API
# Author Ando Roots 2011
import sys
import urllib
import urllib2
@anroots
anroots / stealticket.py
Created May 26, 2012 13:50
Pseudo-code, proof-of-concept: tickets are stealable
# Pseudo-code to prove that some tickets are hackable
# Blog post: http://sqroot.eu/2012/05/easily-guessable-uri-s-not-a-good-idea
# Ticket URI, visible to the World: https://www.yyy.ee/et/checkout/printer/XXXXXX/XXXXXXX/
# Make a HTTPS connection and return the status code of the URI
# 200 means that the ticket exists
def get_http_status_code(ticket_number, print_number):
return url.open(ticket_uri(ticket_number, print_number)).get_status()
# Return the full URI of the ticket
@anroots
anroots / example.php
Created August 14, 2012 13:14
SQL vs ORM
<?php
// ...
/**
* Check if an employee has the training $training_id
*
* @since 2.2.3
* @static
* @param int $employee_id
@anroots
anroots / Identity.php
Last active September 5, 2020 09:56
Example implementation of the LightOpenID library in Kohana
<?php defined('SYSPATH') or die('No direct script access.');
/**
* Represents an OpenID identity
*
* @since 0.1
*/
class Model_User_Identity extends ORM {
protected $_updated_column = FALSE;
@anroots
anroots / blinker.py
Created January 24, 2013 20:42
Python script to blink two LED-s on/off from a Raspberry Pi
#!/usr/bin/env python
# Script for blinking two LED-s connected to a Raspberry Pi
#
# Author Ando Roots <ando@sqroot.eu>
# Created 24 Jan 2013
# Usage: run from CRON every 10 minutes
# Link http://sqroot.eu/2013/01/pi-hacking-1-my-intro-to-the-world-of-electronics
import RPi.GPIO as GPIO, time, datetime
@anroots
anroots / SoundMonitor.py
Created January 27, 2013 09:29
Python script for Raspberry Pi, Adafruit 7-segment 4-digit LCD backpack and a LED. Uses an USB mic to measure and display sound level.
#!/usr/bin/python
# Sound level indicator on a 7-segment 4-digit LCD, for Raspberry Pi
# Uses a USB mic to measure sound level
#
# https://github.com/adafruit/Adafruit-Raspberry-Pi-Python-Code/blob/master/Adafruit_LEDBackpack/Adafruit_7Segment.py
# https://github.com/adafruit/Adafruit-Raspberry-Pi-Python-Code/blob/master/Adafruit_LEDBackpack/Adafruit_LEDBackpack.py
# https://github.com/adafruit/Adafruit-Raspberry-Pi-Python-Code/blob/master/Adafruit_I2C/Adafruit_I2C.py
#
# Author Ando Roots <ando@sqroot.eu> 2013
@anroots
anroots / err.py
Created February 2, 2013 19:17
Show the number of online viewers of ETV on a 7-segment display. For Raspberry Pi and Adafruit LED Backpack
#!/usr/bin/python
# Show the number of viewers of ERR ETV online TV-channel on a 7-segment LCD
# Built for the Raspberry Pi
#
# http://otse.err.ee/etv/
# https://github.com/adafruit/Adafruit-Raspberry-Pi-Python-Code/blob/master/Adafruit_LEDBackpack/Adafruit_7Segment.py
# https://github.com/adafruit/Adafruit-Raspberry-Pi-Python-Code/blob/master/Adafruit_LEDBackpack/Adafruit_LEDBackpack.py
# https://github.com/adafruit/Adafruit-Raspberry-Pi-Python-Code/blob/master/Adafruit_I2C/Adafruit_I2C.py
#