Skip to content

Instantly share code, notes, and snippets.

@maemre
maemre / create-file.cpp
Created May 11, 2014 15:55
create an empty file in c++ using streams
#include <iostream>
#include <fstream>
using namespace std;
int main(int argc, char *argv[]) {
if (argc != 2) {
cout << "Usage: " << argv[0] << " FILE_NAME";
exit(EXIT_FAILURE);
}
@maemre
maemre / brew-doctor.log
Created January 31, 2014 19:56
Brew Io build failure
Warning: Your file-system on / appears to be CaSe SeNsItIvE.
Homebrew is less tested with that - don't worry but please report issues.
@maemre
maemre / json-benchmark.py
Created December 6, 2013 22:12
Python JSON encode/decode benchmark for short strings
#!/usr/bin/env python
import time as t
import ujson as u
import simplejson as s
import json as j
N = 100000
x = [{"asderdgaveargeraf": {"asdregegf":3}, "jsdsafsdafkfds":[3, 4], 4:"sadkjsadfekjsdfkljsdfbkdjsf"}] * 2
@maemre
maemre / courses.py
Created August 14, 2013 21:02
A simple Python 3 script that finds some courses that are not conflicting with my schedule.
import urllib.request as u
import re
# Soppus' private web API
url = 'http://www.soppus.com/courseComplete.php'
# regular expression of the courses, I use only HTR311 for now
regex = re.compile(r'HTR311.*')
# Fetch the data and filter appropriate courses
@maemre
maemre / FizzBuzz.hs
Last active December 21, 2015 01:48
A solution to infamous FizzBuzz test in Haskell
module Main where
fb x
| x `divp` (3*5) = "FizzBuzz"
| x `divp` 3 = "Fizz"
| x `divp` 5 = "Buzz"
| otherwise = show x
where divp x y = (mod x y == 0)
main =
// ==UserScript==
// @name Use Markdown, sometimes, in your HTML.
// @author Paul Irish <http://paulirish.com/>
// @link http://git.io/data-markdown
// @match *
// ==/UserScript==
// If you're not using this as a userscript just delete from this line up. It's cool, homey.