Skip to content

Instantly share code, notes, and snippets.

@mkosler
mkosler / p1.cpp
Last active December 1, 2020 20:52
Advent of Code 2020: Day 1
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
int main(int argc, char* argv[])
{
std::vector<int> expenses;
std::stringstream ss;
@mkosler
mkosler / nightbot-dice-roll.js
Created November 19, 2020 17:21
Nightbot variable dice roll
!commands edit !roll $(eval var c = isNaN(parseInt(`$(query)`)) ? 20 : parseInt(`$(query)`); `d${c}: ${Math.floor(Math.random() * c) + 1}`)

The Legend of Zelda: A Link to the Past

Hyrule Castle

  1. Get Torch in room.
  2. Left at entrance
  3. Two green guards, line up with bottom pole, move between right most walls
  4. Get boomerang in left room with guard.
  5. Chain guard: 2 pots or 8 slashes
  6. Cross, dark room: Key in right arm
Incantation
Harvest Moon
Power Piggs of the Dark Ages
Kirby Super Star
Maui Mallard in Cold Shadow
Mystery Dungeon: Shiren the Wanderer
Terranigma
Captain Novolin
Rex Ronan: Experimental Surgeon
Packy and Marlon
obs = obslua
source_name = ""
last_text = ""
activated = false
obs_output = nil
full_text = 'Dropped frames: '
-- Function to set the time text
@mkosler
mkosler / typeshift-solver.py
Created March 25, 2017 14:14
I got frustrated ;)
#!/usr/bin/python
# Arguments:
# A file consisting of all the letters in a column per line.
# For example, a puzzle looking like:
# A B C
# D E F
# G H I
# J K
# L
#include <cstdlib>
#include <iostream>
#include <SDL.h>
#include <theoraplayer\TheoraPlayer.h>
int main(int argc, char *argv[])
{
if (SDL_Init(SDL_INIT_VIDEO)) {
std::cerr << "Failed to initialize SDL: " << SDL_GetError() << std::endl;
function Level:setMood(mood)
for i,interactive in ipairs(self.interactives) do
if interactive.name == "Barrier" then
interactive.body:setActive(interactive.type ~= mood)
end
end
end
@mkosler
mkosler / ball.lua
Created March 23, 2013 05:30
Manager
-- Possible topic:
-- - The require statement
local Manager = require 'manager'
-- Possible topic:
-- - Object-oriented programming
local Ball = Class{}
function Ball:init(x, y, r)
self.x = x
self.y = y
@mkosler
mkosler / downsample.cpp
Created March 20, 2013 01:20
Bad downsampling! Bad!
void Canvas::downsample(float *pixels, unsigned side)
{
unsigned nside = side / 2;
for (unsigned i = 0; i < nside * nside; i++) {
unsigned row = i / nside;
unsigned x = (i * 2) + (row * side);
unsigned y = x + 1;
unsigned z = x + side;
unsigned w = z + 1;