Skip to content

Instantly share code, notes, and snippets.

View BlameOmar's full-sized avatar

Omar Evans BlameOmar

View GitHub Profile
@BlameOmar
BlameOmar / SSH Configuration.md
Last active February 26, 2021 17:54
SSH Configuration for Hunter CS students

SSH Configuration for Hunter CS Students

To remotely access the CS Lab computers (cslab1, cslab2, etc.), you must use an SSH client. OpenSSH is part of (Mac) OS X, most modern Linux distributions and *BSD operating systems (e.g. Ubuntu, Fedora, FreeBSD, etc.). Windows does not include an SSH client as part of the operating system, so you may need to download and install one.

TODO: Add list of Windows SSH clients.

OpenSSH

Setup lisp with slime on OS X

Install your favorite lisp interpreter

If you already have Homebrew, just open a terminal and type

$ brew install clozure-cl
@BlameOmar
BlameOmar / async_error_handling.md
Last active August 16, 2016 10:42
Asynchronous Error Handling in Swift 2.0

Asynchronous Error Handling in Swift 2.0

As Swift 1.0 did not include support for exceptions, a common error handling pattern was to use a Result enum that either took on a value on success, or an error on failure. In a way, this was superior to using exceptions, since being a instantiable type, Results could be passed around freely, enabling asynchronous code to use the same error handling mechanisim as synchronous code. Using Swift's robust support for custom operators, this also enabled Railway Oriented Programming for more functional oriented programers.

Swift 2.0 introduces throwable errors, which are similar to exceptions. However, like exceptions, thrown errors

@BlameOmar
BlameOmar / content_negotiation.lua
Last active December 22, 2015 08:49
Content Negotiation Lua Script for nginx
-- Content negotiation for nginx using the lua module
-- Version 0.2
-- ©2013 Omar Stefan Evans
-- Based on the content negotiation script for Lighttpd written by Michael Gorven
-- (http://michael.gorven.za.net/blog/2009/04/13/content-negotiation-lighttpd-lua)
-- It is licensed under a BSD license.
-- Permission is hereby granted, free of charge, to any person obtaining a copy of
-- this software and associated documentation files (the "Software"), to deal in
@BlameOmar
BlameOmar / main.cpp
Last active August 29, 2015 14:22
TicTacToe (2010)
//Omar Evans
//TicTacToe Version 2
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <ctime>
#ifdef WIN32
#include <windows.h>
#define clear() system("cls")
#else
@BlameOmar
BlameOmar / mergesort.cpp
Last active August 29, 2015 14:20
mergeSort2 is an implementation of merge sort that uses O(n) extra space (copies the array exactly once) instead of O(nlog(n))
#include <iostream>
#include <vector>
#include <random>
using namespace std;
/* Returns whether a list is sorted */
bool isSorted(vector<int> & list);
/* Sorts a list using the standard merge sort algorithm everyone learns in school (requires O(nlog(n)) space) */
@BlameOmar
BlameOmar / MyLovelyProgram.c
Last active August 29, 2015 14:00
A lovely program. By Omar & Grace
#include <stdio.h>
int main() {
char myLovelyString[] = "You're lovely...too";
puts(myLovelyString);
return 0;
}
@BlameOmar
BlameOmar / Run Time Type Information Example.cpp
Last active August 29, 2015 13:58
I wrote this because I couldn't find any practical examples, just information on dynamic_cast and typeid work. Supposedly this is because it's more taboo than goto and therefore no one should even think about using it. Obviously, I disagree.
/**
* ©2014 Omar Stefan Evans.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
@BlameOmar
BlameOmar / Makefile
Last active August 29, 2015 13:56
Sample Makefile for Hunter CS Students
CXX = g++
CXXFLAGS = -Wall
DOCUMENTATION =
BUILD_SYSTEM_FILES = Makefile
DATA_FILES =
SOURCE_FILES = main1.cpp main2.cpp ClassA.h ClassA.cpp ClassB.h ClassB.cpp