Skip to content

Instantly share code, notes, and snippets.

View mindey's full-sized avatar
🚀
Working from Earth...

Mindey mindey

🚀
Working from Earth...
View GitHub Profile

Text Parsing for Sharing

Task description

I have a text-based wiki (a VimWiki) and I want to share arbitrary parts of its texts by automatically copy-pasting the parts marked with {:group1,group2,..,groupN| PART :} into the (shared) folders defined for each group. For example, let's say we have just a single wiki page called OnePage.wiki, and group definitions in GroupDefinitions.wiki.

The task is to recursively copy the extracted and merged fractions of the text into appropriate folders. (Should be a recursive split-apply-merge.) The code you write would be made public, and GPL-licensed.

GroupDefinitions.wiki

@mindey
mindey / importable_notebooks.py
Created February 12, 2015 14:09
importable notebooks
# according to http://nbviewer.ipython.org/github/adrn/ipython/blob/master/examples/Notebook/Importing%20Notebooks.ipynb
import io, os, sys, types
from IPython.nbformat import current
from IPython.core.interactiveshell import InteractiveShell
def find_notebook(fullname, path=None):
"""find a notebook, given its fully qualified name and an optional path
This turns "foo.bar" into "foo/bar.ipynb"
and tries turning "Foo_Bar" into "Foo Bar" if Foo_Bar
#!/usr/bin/python
import urllib
import urllib2
import libxml2
import inspect
import sys
import zlib
import base64
import struct
# according to http://jdfreder-notebook.readthedocs.org/en/docs/examples/Notebook/Importing%20Notebooks.html
import io, os, sys, types
from IPython import get_ipython
from IPython.nbformat import current
from IPython.core.interactiveshell import InteractiveShell
def find_notebook(fullname, path=None):
"""find a notebook, given its fully qualified name and an optional path
This turns "foo.bar" into "foo/bar.ipynb"
ffmpeg -video_size 1600x900 -framerate 30 -f x11grab -i $DISPLAY -f alsa -ac 2 -i pulse -vsync passthrough -c:v libx264 -qp 0 -preset ultrafast capture.mkv

Often, we would like to use "Python" as calculator. However, "ipython" command loads much slower than "R". Here is a solution -- let's define an "S" command:

Install http://mpmath.org/'s pack globally.

sudo pip install mpmath

Create initialization script ~/.S.py with following content, for 50 digits of precision:

#!/usr/bin/env python
""" A simple screen-capture utility. Utilizes ffmpeg or avconv with h264
support. By default it captures the entire desktop.
"""
################################ LICENSE BLOCK ################################
# Copyright (c) 2011 Nathan Vegdahl
#
# Permission is hereby granted, free of charge, to any person obtaining a copy

Keybase proof

I hereby claim:

  • I am mindey on github.
  • I am mindey (https://keybase.io/mindey) on keybase.
  • I have a public key whose fingerprint is 5AFD B16B 8980 5133 F450 688B DA58 0D1D 5F5C C7AD

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am mindey on github.
  • I am mindey (https://keybase.io/mindey) on keybase.
  • I have a public key whose fingerprint is 5AFD B16B 8980 5133 F450 688B DA58 0D1D 5F5C C7AD

To claim this, I am signing this object: