Skip to content

Instantly share code, notes, and snippets.

View jonasraoni's full-sized avatar
☠️
Do what you want cause a pirate is free! You are a pirate!

Jonas Raoni Soares da Silva jonasraoni

☠️
Do what you want cause a pirate is free! You are a pirate!
View GitHub Profile
var _, D;
(_ = function(){return this["trela".match(/\w/g)["reverse"]().join("")];})[false] = "jonas";
_()(_[ (_(_)===D )]);
@jonasraoni
jonasraoni / align.c
Created October 25, 2017 22:59
Displays the memory alignment of each data type.
#include <stdio.h>
#define ALIGN_OF(t) ((int)(sizeof(struct{char c; t x;}) - sizeof(t)))
int main()
{
printf("char: %d\n", ALIGN_OF(char));
printf("short: %d\n", ALIGN_OF(short));
printf("int: %d\n", ALIGN_OF(int));
printf("long: %d\n", ALIGN_OF(long));
@jonasraoni
jonasraoni / bitwise-pascal.pas
Created October 23, 2017 14:12
Functions to set/get bits on a DWord
function GetBit(const Value: DWord; const Bit: Byte): Boolean;
begin
Result := (Value and (1 shl Bit)) <> 0;
end;
function EnableBit(const Value: DWord; const Bit: Byte; const TurnOn: Boolean): DWord;
begin
Result := (Value or (1 shl Bit)) xor (Integer(not TurnOn) shl Bit);
end;