Skip to content

Instantly share code, notes, and snippets.

@calmofthestorm
calmofthestorm / Cargo.lock
Created May 30, 2021 20:10
Sled high memory use example with many small objects
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
[[package]]
name = "autocfg"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
[[package]]
name = "bitflags"
[package]
name = "downhill"
version = "0.1.0"
authors = ["Alex Roper <alex@aroper.net>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
sled = "0.32.0"
@calmofthestorm
calmofthestorm / main.rs
Created April 10, 2020 02:55
Orgize properties drawer bugs
use std::io::{Read, Write};
fn good1() {
let data = r"* Day
:PROPERTIES:
:SPAGHETTI:
:END:
";
let mut current = data.to_string();
@calmofthestorm
calmofthestorm / _lists.py
Created June 30, 2014 17:54
Example of ListRef for pluggable vocab
from aenea.proxy_nicknames import Grammar, MappingRule, Text, CompoundRule
grammar = Grammar('hello world')
import dragonfly
import json
import os
dlist = dragonfly.DictList('vocab list')
"""A command module for Dragonfly, for controlling eclipse.
-----------------------------------------------------------------------------
Licensed under the LGPL3.
"""
from dragonfly import (
MappingRule,
AppContext,
IntegerRef,
" Defines a submode to rapidly choose a register to paste. When entered,
" pastes the default register. Pressing any number will undo the previous
" paste and paste the corresponding kill register. Pressing any letter will
" paste that register in a similar manner.
"
" This is a super lightweight alternative to
" https://github.com/vim-scripts/YankRing.vim and
" https://github.com/maxbrunsfeld/vim-yankstack, which don't seem to play
" nice with heavily customized keymaps since they need to hook into
#!/usr/bin/env python
# encoding: utf-8
import argparse
import json
import os
import select
import socket
import subprocess
import sys
// Put cursor at start of file and execute this: 6jwgc2jgc2jgc2j
#include <stdio.h>
int main()
{
int i;
for (i = 0; i < 3; ++i) {
printf("i is %i.\n", i);
}
return 0;
@calmofthestorm
calmofthestorm / gist:5397474
Created April 16, 2013 16:43
Simple example of std::move use with stacks to avoid copies.
#include <stack>
#include <memory>
int main() {
std::stack<std::unique_ptr<int>> A, B;
A.push(std::unique_ptr<int>(new int{1}));
A.push(std::unique_ptr<int>(new int{2}));
A.push(std::unique_ptr<int>(new int{3}));