Skip to content

Instantly share code, notes, and snippets.

View ecs.cpp
// compile with g++ ecs.cpp -std=c++2a -o run && ./run
// Taken from my project, https://github.com/splinterofchaos/py-srpg
#include <vector>
#include <tuple>
#include <iostream>
template<typename F, typename...T>
constexpr auto tuple_map(F&& f, const std::tuple<T...>& t) {
return std::tuple(f(std::get<T>(t))...);
View leetcode: Strong Password Checker.cpp
struct Seq {
size_t start, size;
};
ostream& operator<<(ostream& os, const Seq& s) {
return os << "[" << s.start << ", " << s.size << ")";
}
// Returns the number of replacements or additions required to break sequences to have no triplets.
View gita.profile
SCRIPT /usr/local/share/nvim/runtime/syntax/syncolor.vim
Sourced 1 time
Total time: 0.001307
Self time: 0.001307
count total (s) self (s)
" Vim syntax support file
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2001 Sep 12
@splinterofchaos
splinterofchaos / nasync.vim
Last active Aug 29, 2015
A small script for running asynchronous nvim commands.
View nasync.vim
" From an embedded instance, evaluates an expression and sends the result back
" to the parent instance to be executed by a callback.
function! nasync#up(expr, callback)
call rpcnotify(1, 'vim_eval', a:callback . '(' . string(eval(a:expr)) . ')')
endfunction
function! s:arg_str(...)
return join(map(copy(a:000), "string(v:val)"), ',')
endfunction
View term-test.vim
let s:buf = -1
function! s:exit_handler()
execute 'bdelete!' s:buf
endfunction
function! s:test()
vnew
let s:buf = bufnr('%')
let id = termopen('sleep 1', { 'on_exit': function('s:exit_handler') })
View proj.cpp
#include <algorithm>
#include <cassert>
#include <functional>
#include <iostream>
#include <vector>
#include <fu/fu.h>
struct Person {
@splinterofchaos
splinterofchaos / Py.h
Last active Aug 29, 2015
Python API in C++
View Py.h
#ifndef PY_H
#define PY_H
#include <Python.h>
#include <type_traits>
#include <utility>
#include <string>
template<typename R, typename...X>
View gist:7985be54515f72124883
==18492== Memcheck, a memory error detector
==18492== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==18492== Using Valgrind-3.10.0 and LibVEX; rerun with -h for copyright info
==18492== Command: nvim
==18492== Parent PID: 21288
==18492==
==18492== Invalid read of size 4
==18492== at 0x4B2ED1: copy_tv (eval.c:16794)
==18492== by 0x4B15BE: get_var_tv (eval.c:15965)
==18492== by 0x499294: eval7 (eval.c:4114)
View proc.vim
let s:buf = 0 " The buffer we use to write/send data.
let s:job = 0 " The job that runs the commands.
let s:inbuf = '' " Data pending, sending to s:job.
command! Proc call s:new()
command! -nargs=* ProcDoLine call s:do_cmd(<f-args>)
command! ProcStop call jobstop(s:job)
command! ProcPressEnter call s:on_enter()
@splinterofchaos
splinterofchaos / Makefile
Created Oct 6, 2014
Uv stdout and stderr
View Makefile
a.out : err.c
gcc err.c