Skip to content

Instantly share code, notes, and snippets.

Avatar
🚀
Working from Earth...

Mindey mindey

🚀
Working from Earth...
View GitHub Profile
View importable_notebooks.py
# 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
View rec.sh
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
View S-comand.md

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:

View streetview.py
#!/usr/bin/python
import urllib
import urllib2
import libxml2
import inspect
import sys
import zlib
import base64
import struct
View recordscreen.py
#!/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
View TextParseForShare.md

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

View keybase.md

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:

View keybase.md

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:

View complex_frames.py
# Practically, it's useful if we have complex observations (rows) and variables (columns):
df = pandas.DataFrame(
data=pandas.np.array(
[[1,2,3,4,5],
[6,7,8,9,10],
[11,12,13,14,15]]).T,
index=pandas.MultiIndex.from_arrays(
[['x','x','x','y','z'],
['a','a','b','b','c'],