Skip to content

Instantly share code, notes, and snippets.


Yorick Peterse YorickPeterse

View GitHub Profile
View fix.rb
# frozen_string_literal: true
module Gitlab
module BackgroundMigration
# Background migration for fixing merge_request_diff_commit rows that don't
# have committer/author details due to
# This migration acts on a single project and corrects its data. Because
# this process needs Git/Gitaly access, and duplicating all that code is far
#!/usr/bin/env python
import neovim
import time
import re
import subprocess
def memory_of(pid):
file = open('/proc/{}/status'.format(pid), 'r')
View lol_rails.sql
-- Before
SELECT "namespaces".*
FROM "namespaces"
WHERE "namespaces"."type" IN ('Group')
AND "namespaces"."id" = 2
AND "namespaces"."type" IN ('Group')
AND "namespaces"."type" = 'Group'
ORDER BY "namespaces"."id" DESC
View main.scm
(import bootstrap)
(import std integer)
(import std array)
(import std stdout)
(import std process)
; Defines the "main" module, #f indicating it has no explicit receiver. This means it will be defined
; in the default location.
(let main (defmod bootstrap "main" #f))
View closure.aeon
# __get_binding_of_caller and __run_code is a compiler hack to invoke VM
# instructions directly.
class Closure:
def construct(code):
let @code = code
let @binding = __get_binding_of_caller(_)
pub def call(args...):
__run_code(_, @code, args, @binding)
View 1_ping_pong.aeon
# The __foo stuff is a compiler hack for running raw instructions,
# so __foo runs the "foo" instruction. The single "_" stuff is to
# tell the compiler to automatically generate a register for a value.
class Pid:
def construct(id):
let @id = id
pub def id:
View lexer.rb
# line 1 "lib/aeon/lexer.rl"
# line 3 "lib/aeon/lexer.rl"
module Aeon
class Lexer
# line 9 "lib/aeon/lexer.rb"
class << self
attr_accessor :_aeon_lexer_trans_keys
View bootstrap.aeon
let object_class = __get_toplevel(_)
let object_iproto = __set_object(_)
# Make sure that instance methods of Object are also available to Object (the
# class) itself.
__set_prototype(object_class, object_iproto)
__set_literal_attr(object_class, '__iproto', object_iproto)
View gist:cb5b1f58d7f10a4d3b96f24e28b87d77
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')
5 def +(other):
6 __integer_add(_, self, other)
8 def -(other):
9 __integer_sub(_, self, other)
View gist:0e72898c5f7727de2303747ae62383bc
eon $ cat -n /tmp/test.aeon
1 def add(Integer left, Integer right) -> Integer:
2 return __integer_add(left, right)
4 def print(String message) -> Integer:
5 return __stdout_write(message)
7 def int_to_string(Integer int) -> String:
8 return __integer_to_string(int)