Skip to content

Instantly share code, notes, and snippets.

View tondrej's full-sized avatar

Ondrej Kelle tondrej

View GitHub Profile
@tondrej
tondrej / Project1.dpr
Created January 24, 2019 07:09
GetWindowMenuItemRect example
program Project1;
uses
Forms,
Unit1 in 'Unit1.pas' {Form1};
{$R *.res}
begin
Application.Initialize;
@tondrej
tondrej / ordinals.md
Last active July 14, 2019 12:54
Ordinals
type min (dec) max (dec) min (hex) max (hex) size C type
Shortint -128 127 80 7F 1 signed char
Byte 0 255 00 FF 1 unsigned char
Smallint -32768 32767 8000 7FFF 2 signed short
Word 0 65535 0000 FFFF 2 unsigned short
Integer -2147483648 2147483647 80000000 7FFFFFFF 4 signed long
Cardinal 0 4294967295 00000000 FFFFFFFF 4 unsigned long
Int64 -9223372036
@tondrej
tondrej / restore.sh
Created November 24, 2018 16:17
restore.sh
#!/bin/bash
# http://errietta.me/blog/luks-clonezilla/
cryptsetup luksOpen /dev/sda5 crypt
modprobe dm-mod
vgchange -ay
tar -jxvf sda1.img.tar.bz2
partclone.ext4 -r -s ./sda1.img -o /dev/sda1
rm sda1.img
@tondrej
tondrej / backup.sh
Created November 24, 2018 16:17
backup.sh
#!/bin/bash
# http://errietta.me/blog/luks-clonezilla/
cryptsetup luksOpen /dev/sda5 crypt
modprobe dm-mod
vgchange -ay
partclone.ext4 -c -s /dev/sda1 -o ./sda1.img
tar -jcvf sda1.img.tar.bz2 sda1.img && rm sda1.img
@tondrej
tondrej / rectangle.pas
Created November 11, 2018 21:23
Rectangle
type
TRectangle = class(TNativeObject)
class procedure InitializeInstance(AInstance: JsValueRef; Args: PJsValueRef; ArgCount: Word); override;
class function InitializePrototype(AConstructor: JsValueRef): JsValueRef; override;
end;
class procedure TRectangle.InitializeInstance(AInstance: JsValueRef; Args: PJsValueRef; ArgCount: Word);
var
ArgsArray: PJsValueRefArray absolute Args;
ShapeCtr: JsValueRef;
@tondrej
tondrej / test_classes.pas
Last active November 12, 2018 07:46
Inheritance test
procedure TNativeClassTestCase.TestInheritance;
// - Shape (x, y) => Object
// - Circle (x, y, r) => Shape (x, y)
// - Rectangle (x, y, w, h) => Shape (x, y)
// - Square (x, y, w) => Rectangle (x, y, w, w)
Runtime: TChakraCoreRuntime;
Context: TChakraCoreContext;
ShapeObj, CircleObj, RectangleObj, SquareObj: JsValueRef;
begin
Runtime := nil;
@tondrej
tondrej / square.js
Created November 11, 2018 20:36
Square
function Square(x, y, w) {
Rectangle.call(this, x, y, w, w);
}
Square.prototype = Object.create(Rectangle.prototype);
Square.prototype.constructor = Square;
@tondrej
tondrej / circle.js
Created November 11, 2018 20:33
Circle
function Circle(x, y, r) {
Shape.call(this, x, y);
this.r = r;
}
Circle.prototype = Object.create(Shape.prototype);
Circle.prototype.constructor = Circle;
@tondrej
tondrej / shape.js
Created November 11, 2018 20:31
Shape
function Shape(x, y) {
this.x = x;
this.y = y;
}
Shape.prototype.move = function(x, y) {
this.x += x;
this.y += y;
};
@tondrej
tondrej / lazarus-external-tools-linux-mint.xml
Created October 20, 2018 09:32
Lazarus External Tools
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG Version="3" Count="4">
<Tool1>
<Title Value="Explore to Source Directory"/>
<Filename Value="caja"/>
<CmdLineParams Value="$Path($EdFile())"/>
<HideWindow Value="False"/>
</Tool1>
<Tool2>
<Title Value="Explore to Target Directory"/>