Skip to content

Instantly share code, notes, and snippets.

local vector = {}
vector.__index = vector
local function is_vector(t)
return getmetatable(t) == vector
end
function vector.new(x, y)
return setmetatable({ x = x or 0, y = y or 0 }, vector)
end

Reasons I use Linux:

  1. Fast filesystem. It's about ~45x faster than NTFS for me and add an SSD to that and you have quite fast r/w speeds.
  2. Package manager allows me to install software and tools insanely easily.
  3. Work stations allows me to have multiple desktops in a single screen and switch through them seamlessly.
  4. Theming support is really simple and if you don't like it you can just choose another Desktop Environment to use.
  5. Directory structure is suitable for dependencies when programming and makes it a breeze (/usr/lib and /usr/include)
  6. The terminal is much more powerful than silly cmd.exe and I have ncurses support as well.
  7. GDB has a -tui mode that I can use for better debugging.
  8. Relates to #4 but everything is customisable and you can choose something if you don't like it (similar to Android)
@Rapptz
Rapptz / rdanny.md
Created December 20, 2015 00:29
R. Danny v3.0.0

R. Danny v3.0.0 ideas:

  • Fully asyncio rewrite.
    • Will use the async branch (or v0.10.0) when it becomes available.
  • Authority system based on permissions/roles.
    • e.g. Manage Messages -> !cleanup is valid
    • e.g. Bot Mod -> can call bot commands without having the permissions themselves
    • This will make it easier for people to administrate on servers I'm not on.
  • Remove cronjob and pass it in as a background task to the event loop
  • Lowers the need of dependencies by quite a bit.
@Rapptz
Rapptz / hscards.json
Last active February 27, 2021 14:24
Hearthstone Cards
[
{
"id": 7,
"name": "Garrosh Hellscream",
"description": "",
"image": "http:\/\/wow.zamimg.com\/images\/hearthstone\/cards\/enus\/medium\/HERO_01.png",
"class": "warrior",
"type": "hero",
"quality": "free",
"race": "none",
@Rapptz
Rapptz / tiebreaker.md
Created December 14, 2014 19:19
Median-Buchholz

How Median-Buchholz tie breaker works.

Assumptions:

  1. We are talking about 2 different players, P1 and P2.
  2. They each played 6 rounds.
  3. They each won 4 of them and lost two of them (i.e. they're tied).

After all 6 rounds, the opponents for P1 ended up with the following track record:

@Rapptz
Rapptz / stats.md
Last active October 29, 2018 05:29
Statistics for /r/smashbros

/r/smashbros Statistics

  • Statistics processed at 2015-05-26T23:02:47.304000
  • Total number of posts processed: 100
  • Average score: 112.40 (± 252.79)

Overview

Stat Video Self Video Self Giflike Self Image Tweet Self Tweet Misc Self Misc
@Rapptz
Rapptz / strawpoll_bot.py
Created April 27, 2015 20:33
A strawpoll bot for /u/-anti
#!/usr/bin/env python
import praw
import requests
### configuration
username = '...'
password = '...'
subreddit = '...'
# use {url} to get the strawpoll url
import sublime, sublime_plugin
import os.path
import platform
def compare_file_names(x, y):
if platform.system() == 'Windows' or platform.system() == 'Darwin':
return x.lower() == y.lower()
else:
return x == y
import sublime, sublime_plugin
def open_url(url):
sublime.active_window().run_command("open_url", { "url": url })
class PromptQuickDocCommand(sublime_plugin.WindowCommand):
def run(self):
self.window.show_input_panel("Documentation Search:", "", self.on_done, None, None)
pass
#include <type_traits>
#include <iterator>
#include <initializer_list>
#include <stdexcept>
template<typename T>
using StorageFor = typename std::aligned_storage<sizeof(T), std::alignment_of<T>::value>::type;
template<typename T, size_t N>
struct static_vector {