Skip to content

Instantly share code, notes, and snippets.

View ravern's full-sized avatar
What's up?

Ravern Koh ravern

What's up?
  • Singapore
View GitHub Profile
edc/bass
ravernkoh/theme-gnuykeaj
fisherman/rbenv
bind main P !git push origin %(branch)
function cdx
if count $argv > /dev/null
set proj $argv[1]
else
echo "Error: destination not provided."
return 1
end
set dest (jq -r ".[\"$proj\"]" ~/.config/cdx/config.json)
if [ $dest != "null" ]
@ravern
ravern / simple_expression_evaluator.c
Last active November 7, 2018 03:14
simple_expression_evaluator.c
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef int bool;
#define TRUE 1
#define FALSE 0
#define MAX_STACK_LEN 20
@ravern
ravern / precedence_parser.py
Created November 5, 2018 11:34
precedence_parser.py
# Grammar
#
# program -> expression
#
# expression -> operation
#
# operation -> atom {binary_operator atom}
#
# atom -> literal
# atom -> LEFT_PAREN expression RIGHT_PAREN
@ravern
ravern / matrix_rotation.py
Created August 10, 2018 17:20
Matrix Rotation Challenge
# Given an image represented by an NxN matrix, where each pixel in the image is
# 4 bytes, write a method to rotate the image by 90 degrees. Can you do this in
# place?
# Displays the given matrix.
def display(matrix):
N = len(matrix)
for column in range(0, N):
for row in range(0, N):