Skip to content

Instantly share code, notes, and snippets.

@Rapptz
Rapptz / fun.cpp
Created Feb 22, 2014
Herding Simulator 2014
View fun.cpp
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <random>
static std::random_device rd;
static std::mt19937 gen(rd());
static std::uniform_int_distribution<> dist(5, 30);
static std::uniform_int_distribution<> negator(0, 1);
View goty.cpp
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <random>
#include <map>
#include <stdexcept>
#include <functional>
#include <cstdlib>
View base64.hpp
// The MIT License (MIT)
// Copyright (c) 2013-2014 Rapptz, Danny Y.
// 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:
@Rapptz
Rapptz / Makefile
Last active Aug 29, 2015
An attempt at a generic Makefile.
View Makefile
# Generic Makefile to help get started
# Requires sh.exe on Windows.
# Assumes GNUMake.
# Made by Rapptz
# name of final output
PROGRAM_NAME := untitled
# where to store the debug and release final output
RELEASE_DIR := ./release
View test.lua
local tuple = require("tuple")
function test(x, y, z)
print(x, y, z)
end
function get()
return 10, 11
end
@Rapptz
Rapptz / signals.cpp
Created Aug 17, 2014
Signal and Slots C++11
View signals.cpp
// C++11 signal/slots
#include <type_traits>
#include <functional>
#include <map>
#include <limits>
namespace signals {
struct connection_key {
private:
connection_key() = default;
@Rapptz
Rapptz / legal.md
Last active Aug 29, 2015
Smash 4 Wii U Legal Stages
View legal.md
@Rapptz
Rapptz / sen.py
Last active Aug 29, 2015
A meta build system for ninja. Called sen.py based on senpai/sempai.
View sen.py
#!/usr/bin/env python
"""Python module that generates .ninja files.
Some of the stuff here was borrowed from the main ninja project.
However this module aims to extend the bare-bones provided with a rich
python API.
Note: This file is meant to be a single file for easy inclusion for existing
build systems. Hence this file will be rather big.
View debug.py
import sys
print(sys.argv)
View client.cpp
#include <net/socket.hpp>
#include <iostream>
int main() {
net::socket client(net::socket::ipv4, net::socket::stream);
client.connect("127.0.0.1", 3667);
std::cout << client.receive(16);
}