Skip to content

Instantly share code, notes, and snippets.

View yorickpeterse's full-sized avatar

Yorick Peterse yorickpeterse

View GitHub Profile
aeon $ cat -n /tmp/test.aeon
1 class Integer:
2 # Overwrites the default prototype with the actual integer prototype.
3 __set_literal_attr(self, __get_integer_prototype(_), '__prototype')
4
5 def +(other):
6 __integer_add(_, self, other)
7
8 def -(other):
9 __integer_sub(_, self, other)
eon $ cat -n /tmp/test.aeon
1 def add(Integer left, Integer right) -> Integer:
2 return __integer_add(left, right)
3
4 def print(String message) -> Integer:
5 return __stdout_write(message)
6
7 def int_to_string(Integer int) -> String:
8 return __integer_to_string(int)
9
def add(Integer left, Integer right) -> Integer:
return __integer_add(left, right)
def print(String message) -> Integer:
return __stdout_write(message)
def int_to_string(Integer int) -> String:
return __integer_to_string(int)
let a = 10
aeon $ cat -n /tmp/test.aeon
1 def add(Integer left, Integer right) -> Integer:
2 __get_local(0, 0)
3 __get_local(1, 1)
4 __integer_add(2, 0, 1)
5 __return(2)
6
7 def print(String message) -> Integer:
8 __get_local(0, 0)
9 __stdout_write(1, 0)
git clone git@github.com:YorickPeterse/ruby-ll.git
cd ruby-ll
bundle install
rake clean compile
ruby test.rb # see Ruby script below
require 'rack'
require 'rubinius/profiler'
class RbxRackProfiler
def initialize(app)
@app = app
end
def call(env)
profiler = Rubinius::Profiler::Instrumenter.new
@yorickpeterse
yorickpeterse / tag_count.rb
Created January 1, 2014 21:22
Counting the amount of title tags of a sub-reddit. Whipped together to see which ones on /r/r4r get the most comments.
require 'httpclient'
require 'json'
url = 'http://www.reddit.com/r/r4r.json'
after = nil
posts = []
client = HTTPClient.new
tags = {
'[M4F]' => 0,
'[M4M]' => 0,
require 'socket'
Socket.gethostbyname('localhost') # => ["localhost.localdomain", ["localhost", "x1carbon", "localhost", "x1carbon"], 10, "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01", "\x7F\x00\x00\x01"]
TCPSocket.gethostbyname('localhost') # => ["localhost.localdomain", ["localhost", "x1carbon", "localhost", "x1carbon"], 10, "::1", "127.0.0.1"]
@yorickpeterse
yorickpeterse / PKGBUILD
Created July 17, 2013 12:36
PKGBUILD for building Android 4 on Arch Linux.
pkgname=android-4.0.3
pkgver=r03
pkgrel=3
pkgdesc='Platform for Google Android SDK'
arch=('any')
url="http://developer.android.com/sdk/index.html"
license=('custom')
depends=('android-sdk>=r17')
_android_api=android-15
_android_ver=android-4.0.4
@yorickpeterse
yorickpeterse / pomodoro.sh
Created July 16, 2013 09:14
Poor man's Pomodoro timer.
#!/usr/bin/env bash
time=1500 # 25 minutes
title="Pomodoro"
icon=/home/yorickpeterse/Pictures/icons/tomato.png
notify-send -i "$icon" "$title" "Starting a new Pomodoro timer"
sleep $time