Skip to content

Instantly share code, notes, and snippets.

@cronin101
cronin101 / lesson.md
Last active December 22, 2015 03:38 — forked from tef/lesson.md

I hate markdown

  1. Here is a list. I can do numbered lists.

  2. I can do a list entry followed by two spaces.
    This means this is in the same paragraph

  3. If I want a code block (with syntax highlighting, inside a list, something breaks:

        print("This needs a blank line before the code block")
@cronin101
cronin101 / Benchmark.rb
Created August 30, 2013 14:03
Benchmark1
#!/usr/bin/env ruby
require './hadope'
require 'benchmark'
puts "Problem, mapping an addition (or two) to a large Array"
Hadope::set_device Hadope::CPU
input = (1..10_000_000).to_a
ruby = Benchmark.realtime {
last = input.map { |i| i + 1 }.map { |j| j + 1 }.last

ersatz bibimbap

bibimbap as i make it is basically

  • rice
  • sitr fried vegetables
  • some meat in tasty spices
  • gochujang (this is fermented soy bean paste with paprika)
  • a fried egg
@cronin101
cronin101 / plot.rb
Last active December 20, 2015 12:39
Graph plotting code example.
#!/usr/bin/env ruby
require 'asymptotic'
class Array
def custom_uniq_1
new_array = []
each do |elem| # you call each method on self here
new_array << elem unless new_array.include?(elem)
@cronin101
cronin101 / invoke.sh
Created July 17, 2013 09:25
OneTrueConfig
git clone git@github.com:cronin101/OneTrueConfig.git --recursive && cd OneTrueConfig && ./install.rb
@cronin101
cronin101 / .vimrc
Last active December 19, 2015 19:49
.vimrc and bundle folder
" Load ~/.vim/bundle packages.
call pathogen#infect()
call pathogen#helptags()
" Use Vim defaults
set nocompatible
" Colorscheme settings.
syntax enable
set t_Co=256
@cronin101
cronin101 / fizzbuzz_hardmode.c
Last active December 19, 2015 07:39
FizzBuzz from 1 to N (supplied as command-line argument) and exiting gracefully without using loops, conditionals, or segfaults - in C.
#include <stdio.h>
#include <stdlib.h>
int i(const int i) { printf("%d\n", i); return i; }
int f(const int i) { printf("Fizz\n"); return i; }
int b(const int i) { printf("Buzz\n"); return i; }
int fb(const int i) { printf("FizzBuzz\n"); return i; }
int (* PC[15])(int i) = { i,i,f,i,b,f,i,i,f,b,i,f,i,i,fb }; // Printer Cycle
int go(const int arg) {
@cronin101
cronin101 / comn.md
Last active December 16, 2015 12:19
COMN Revision Notes

#Computer Networks

Location: St. Leonard's Land Gym 4

Date/Time: Monday 29/04/2013, 09:30:00-11:30:00 (02:00:00)

Examinable Material

?

COMN Required Readings

@cronin101
cronin101 / pokemon_hax.rb
Last active December 15, 2015 14:49
Cheating at pokemon battles.
#!/usr/bin/env ruby
require 'httparty'
require 'nokogiri'
def info_page_html_for(pokemon)
reponse = HTTParty.get "http://bulbapedia.bulbagarden.net/wiki/#{pokemon}_(Pok%C3%A9mon)".force_encoding('UTF-8')
end
def weakness_table_for(pokemon)
@cronin101
cronin101 / toy.c
Last active December 12, 2015 01:29
Printing 1 to N in C without loops, conditionals or segfaults.
#include <stdio.h>
#include <stdlib.h>
void (**functions);
void executeFunction(void(*f)()){
f();
}
void executeFunctionAt(const int index){