Skip to content

Instantly share code, notes, and snippets.

View stg7's full-sized avatar

Steve Göring stg7

View GitHub Profile
@stg7
stg7 / extract_owncloud_sqlite3.py
Created October 21, 2016 21:57
a quick and dirty tool for extraction of contacts and calendar entries from an owncloud sqlite3 database to text formats (ics, vcf)
#!/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')
@stg7
stg7 / json_extractor.py
Created November 6, 2016 01:32
Extract json subelements via command line and printout results on stdout.
#!/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:
[
@stg7
stg7 / json_prettifier.py
Created November 6, 2016 01:33
Prints a json string in a pretty formatted output on stdout
#!/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:
{
@stg7
stg7 / svn2git.sh
Last active March 30, 2017 18:58
Porting a svn to git
#!/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
@stg7
stg7 / argumentparsing.py
Created August 29, 2017 08:51
argument parsing with python3
#!/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
@stg7
stg7 / dropbox_download.sh
Created March 28, 2017 22:14
download dropbox folder if it is too large for a direct download
#!/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=\":" \