Skip to content

Instantly share code, notes, and snippets.

View tychoish's full-sized avatar

Sam Kleinman tychoish

View GitHub Profile
@tychoish
tychoish / argparse_example.py
Last active August 29, 2015 13:55
Python State Object Classes
import argparse
def collect_arguments():
parser = argparse.ArgumentParser()
parser.add_argument('--version')
args = ConfigArgs()
return parser.parse_args(namespace=args)
(defun smart-grep ()
(interactive)
(let ((search-text (buffer-substring-no-properties (region-beginning) (region-end)))
(file buffer-file-name))
(let ((search-dir (concat (substring file 0 (search "/src/" file)) "/src/"))
(search-extension (concat "*." (file-name-extension file))))
(rgrep search-text search-extension search-dir))))
title: Enable authentication on each component in the cluster.
stepnum: 2
ref: enable-auth
pre:
Enable authentication by specifying the key file on each
:program:`mongos` and :program:`mongod` in the cluster, including each
config server and shard. On each, specify the key file by doing one of
the following:
action:
- heading: Specify the key file in the configuration file.
class ConfObj(ConfigurationBase):
@property
def sources(self):
return self.state['sources']
@sources.setter
def sources(self, value):
self.state['source'] = SourceConfig(value)
def get_path(conf, branch):
o = []
if conf.project.name in ['mms', 'meta-driver']:
o.append(conf.project.tag)
if branch == conf.git.branches.manual:
if conf.project.name in ['mms', 'meta-driver']:
if conf.project.name == 'mms' and 'edition' in conf.project:
if conf.project.edition == 'saas':
source/core/gridfs.txt:13: ERROR: Too many autonumbered footnote references: only 0 corresponding footnotes available.
source/core/gridfs.txt:13: ERROR: Unknown target name: "default-chunk-size-change".
source/reference/command/geoNear-field.rst:105: SEVERE: Problems with "include" directive path:
source/reference/command/geoNear-field.rst:105: SEVERE: Problems with "include" directive path: source/includes/deprecation-uniqueDocs.rst
source/reference/command/geoNear-field.rst:147: SEVERE: Problems with "include" directive path:
source/reference/command/geoNear-field.rst:147: SEVERE: Problems with "include" directive path: source/includes/fact-geoNear-restrict-near-in-query.rst
source/reference/command/geoNear-field.rst:181: SEVERE: Problems with "include" directive path:
source/reference/command/geoNear-field.rst:181: SEVERE: Problems with "include" directive path: source/includes/deprecation-uniqueDocs.rst
source/reference/command/geoNear-field.rst:63: SEVERE: Problems with "include" directive path:
source/r
@tychoish
tychoish / epistle-linker
Last active August 29, 2015 14:07
Epistle Linker
I've been using [Epistle](http://kooklab.com/epistle.html) for writing
on my Android devices and while I adore the software there are a
couple of significant limitations. Notably that all files need to be
in one directory with no hierarchy and that all files need to have
`.txt` extensions. I have pretty good file organization in a number of
git repositories, and I don't use the `.txt` extension at all. hile
Epistle is *great*, I needed a way to integrate it with my current
system without causing a nightmare.
Luckily the command line Linux dropbox program recognizes symbolic

Novel Makefile

Background

This makefile-based build system provides a bit of extra gloss/configuration for using Sphinx and sffms to build conventional manuscripts and websites for novel-like hypertexts.

Usage Notes

Download Mail

I've revised the way that my git-mail method for downloading mail works. This system feels much more refined, results in far fewer commits, and resides entirely on the "client," system, which I think makes it easier to reproduce. I need to integrate local mail fetching (i.e. fetchmail) a bit more tightly, and I probably ought to work on porting it to something that isn't zsh/bash.

#!/bin/zsh

Org-Mail

These scripts and glue accept email sent to a secret address and convert the body of the email into a file where the subject of the email becomes an org-mode headline with the body of the note as the body of that org-mode item. Using a custom FILE todo keyword, these items are included in the org-agenda (assuming that ~/mail/inbox.org is included on your agenda.) With a deadline of "today," relative to receipt of the email.