This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
# Pandoc filter that grabs the BibTeX code block from each note file | |
# and then uses bibtexparser to add a "short title" entry in the "note" field, | |
# appending finished BibTeX entry to a bibliography file. | |
from pandocfilters import toJSONFilter, CodeBlock | |
# https://github.com/sciunto/python-bibtexparser | |
import bibtexparser |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find $1 -name "*.wav" -exec sh -c 'sox "$1" --bits 16 "${1%.*}.flac"; rm "$1"' _ {} \; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://stackoverflow.com/questions/10822635/get-the-number-of-rows-in-table-using-sqlalchemy | |
num_rows = session.query(MyTable).count() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
rclone_remote_path = 'drive:/temp' | |
dirs = re.findall('\d+:\d+:\d+\ +-1\ +(.*?)\n', | |
$(rclone lsd -R @(rclone_remote_path))) | |
file_dirs = re.findall('\d+\ +(.*\/?(?=\/))', | |
$(rclone ls @(rclone_remote_path))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def lower_case_all(dirname): | |
import os | |
for dirpath, dirs, files in os.walk(dirname, topdown=False): | |
for filename in files: | |
os.rename(os.path.join(dirpath, filename), | |
os.path.join(dirpath, filename.lower())) | |
for adir in dirs: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
about = {} | |
with open($(find . -d 2 -name '__version__.py').strip()) as f: | |
exec(f.read(), about) | |
tag_version = f"v{about['__version__']}" | |
git tag @(tag_version) | |
git push origin @(tag_version) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version = "1.1.0" | |
major, minor, patch = version.split('.') | |
wget f"https://julialang-s3.julialang.org/bin/linux/x64/{major}.{minor}/julia-{version}-linux-x86_64.tar.gz" | |
tar -xvf f"julia-{version}-linux-x86_64.tar.gz" | |
cp -r f"julia-{version}" /opt/ | |
ln -sf f"/opt/julia-{version}/bin/julia" /usr/local/bin/julia | |
rm -r f"julia-{version}-linux-x86_64.tar.gz" f"julia-{version}" | |
echo "Done: Type 'julia'" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo echo $(gopass completion bash) > /etc/bash_completion.d/gopass |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# see https://github.com/3846masa/upload-gphotos | |
import argparse | |
import os | |
parser = argparse.ArgumentParser() | |
parser.add_argument('--folder', | |
help='Folder of images. Can contain subdirectories') | |
parser.add_argument('--username', help='Your Google Photos username') | |
parser.add_argument('--password', help='Your Google Photos password') | |
parser.add_argument('--ftypes', nargs='+', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class JSONConfigParser(): | |
import collections | |
Option = collections.namedtuple('Option', 'type is_required default') | |
def __init__(self): | |
self._expected = {} | |
def add_option(self, option, type, is_required=False, default=None): | |
self._expected[option] = self.Option(type, is_required, default) |
OlderNewer