Skip to content

Instantly share code, notes, and snippets.

View Swoorup's full-sized avatar
🎲
Focusing

Swoorup Joshi Swoorup

🎲
Focusing
View GitHub Profile
@Swoorup
Swoorup / .tmp.zshrc
Created May 30, 2016 17:00
My zsh config
alias tree='tree -C'
export EDITOR=vim
export PAGER="less"
export LESS="-R"
eval $( dircolors -b $HOME/.dircolors )
@Swoorup
Swoorup / .minttyrc
Created May 30, 2016 16:36
My mintty configuration
Font=Sauce Code Powerline
ForegroundColour=131,148,150
BackgroundColour=0,11,17
CursorColour=220,50,47
Black=7,54,66
BoldBlack=0,43,54
Red=220,50,47
BoldRed=203,75,22
Green=133,153,0
BoldGreen=88,110,117
@Swoorup
Swoorup / astree.c
Created September 14, 2015 06:55
ASTreeNode
typedef struct ASTreeNode
{
int type;
char* szData;
struct ASTreeNode* left;
struct ASTreeNode* right;
} ASTreeNode;
@Swoorup
Swoorup / parser.c
Last active September 14, 2015 06:07
Shell Grammer
<command line> ::= <job>
| <job> '&'
| <job> '&' <command line>
| <job> ';'
| <job> ';' <command line>
<job> ::= <command>
| < job > '|' < command >
<command ::= <simple command>
@Swoorup
Swoorup / sapaths.py
Last active August 29, 2015 14:27 — forked from l1am9111/sapaths.py
Python GTA: SA Path Reader
from struct import unpack
from cStringIO import StringIO
class SAPath():
def __init__(self, node):
self.path = StringIO(open(node, "rb").read())
self.header = {}
self.pathnodes = []
self.navinodes = []
self.links = []
@Swoorup
Swoorup / shell.c
Created August 14, 2015 04:43
Try parsing and executing the syntax tree
// parse the tokens into an abstract syntax tree
if (!lexerbuf.ntoks || parse(&lexerbuf, &exectree) != 0) {
continue;
}
execute_syntax_tree(exectree);
@Swoorup
Swoorup / shell.c
Last active August 29, 2015 14:27
Scan Input, build lexical tokens
// keep getline in a loop in case interruption occurs
int again = 1;
while (again) {
again = 0;
printf("%s", getprompt());
linebuffer = NULL;
len = 0;
ssize_t nread = getline(&linebuffer, &len, stdin);
if (nread <= 0 && errno == EINTR) {
again = 1; // signal interruption, read again
@Swoorup
Swoorup / shell.c
Last active August 29, 2015 14:27
Entry Point
int main()
{
// ignore Ctrl-\ Ctrl-C Ctrl-Z signals
ignore_signal_for_shell();
// set the prompt
set_prompt("swoorup % ");
while (1)