Skip to content

Instantly share code, notes, and snippets.

View pastagatsan's full-sized avatar

gatsan pastagatsan

View GitHub Profile
// Buttlang vs AnalLang comparsion
// 5 count loop :: Buttlang
$def int counter
counter = 0
::loop
PRN $counter$
if counter,<,5
@pastagatsan
pastagatsan / main.c
Created June 20, 2014 19:26
Hello world C program!
#include <stdio.h>
int main(void)
{
puts("Hello world!\n");
return 0;
}
@pastagatsan
pastagatsan / laffd.cpp
Last active August 29, 2015 14:02
C++ program using NCurses!
#include <ncurses.h>
#include <cstdarg>
#include <stdio.h>
char * help = "Q = Quit, CTRL+E = Cycle through modes, CTRL+H = Show help\n";
const char MODE_EDITOR = 0, MODE_KEYPRESS = 1;
const char * modes[] = {"[0] Editor\n", "[1] Keypress Detecting\n"};
char mode = MODE_EDITOR;
void fill(int ln, char * str, ...)
{
int wd = 0, wh = 0, l;
getmaxyx(stdscr, wh, wd);
char * temp_str = "";
sprintf(temp_str, str, ...);
l = len(str);
mvwprintw(stdscr, ln, 0, str, ...);
for (int i = l; i < wd; i++)
{
#include <stdio.h>
int main()
{
char my_string[11];
char * name = "John";
sprintf(my_string, "hello %s", name);
printf(my_string);
}
#include <ncurses.h>
#include <string.h>
const char * words[] = {
"This", "is", "a", "list", "of", "words!"
};
const char * modes[] = {
"[0] Editor", "[1] Keypress"
};
#include <stdio.h>
typedef struct
{
int plebeianness;
char * name;
} pleb;
void print_pleb(pleb p);
@pastagatsan
pastagatsan / laff.cpp
Last active August 29, 2015 14:03
Supposed to get the line number of a character.
int get_line(char * string, int epos)
{
int i = 0, j = 0;
while (true)
{
if (string[j] == '\n') { i++; }
if (j == epos) { return i; }
j++;
}
}
#include "Pleb.h"
Pleb::Pleb()
{
PRINT_INT = 0;
PRINT_HEX = 1;
PRINT_CHAR = 2;
}
Pleb::init(int mem)
[BITS 16]
[ORG 0x7C00]
mov si, cat
jmp printstr
printstr:
lodsb
cmp al, 0
jz hang