Instantly share code, notes, and snippets.

View argumentparsing.py
#!/usr/bin/env python3
import sys
import argparse
def main(args):
""" Example for command line argument parsing using argparse,
if you ever need to program java you can use: [argparse4j](https://argparse4j.github.io/)
"""
parser = argparse.ArgumentParser(description='DESC', epilog="stg7 2016", formatter_class=argparse.ArgumentDefaultsHelpFormatter) # see also here for other options: https://docs.python.org/3/library/argparse.html#argumentparser-objects
View dropbox_download.sh
#!/bin/bash
# if someone send you a link to a dropbox shared folder and you don't want to install the dropbox client
# and it is not possible to download the whole folder via dropbox, than the following script could help you
# change DROPBOXURL to your link url
wget "DROPBOXURL" -O down.html
# where DROPBOX URL is something like: https://www.dropbox.com/sh/ID?dl=0
cat down.html \
| sed "s|href|\\nhref=|g" \
| grep "href=\":" \
View svn2git.sh
#!/bin/bash
# please install git-svn
input_svn="url/to/svn/like/for/checkout"
output_git="url/to/git/like/for/cloning"
mkdir -p _svn
mkdir -p _git
svn co "$input_svn" _svn
View json_prettifier.py
#!/usr/bin/env python3
"""
Prints a json string in a pretty formatted output on stdout.
Example call:
echo "{\"a\":100, \"b\": [1,2,3]}" | ./json_prettifier.py
will print:
{
View json_extractor.py
#!/usr/bin/env python3
"""
Extract json subelements via command line and printout results on stdout.
Example call:
echo "{\"a\":100, \"b\": [1,2,3]}" | ./json_extractor.py b
will print:
[
View extract_owncloud_sqlite3.py
#!/usr/bin/env python3
# a quick and dirty tool for extraction of contacts
# and calendar entries from an owncloud sqlite3 database to text formats (ics, vcf)
#
# run it in your data directory where owncloud.db is stored
import sqlite3
c = sqlite3.connect('owncloud.db')