Skip to content

Instantly share code, notes, and snippets.

View kkappel's full-sized avatar
🏠
Working from home

Klaus Kappel kkappel

🏠
Working from home
View GitHub Profile
@kkappel
kkappel / web2py_env.py
Last active August 29, 2015 14:16 — forked from aabril/web2py_env.py
'''
this snippet is used to load a web2py with postgresql environment
you must install web2py (so gluon.*) from pyeggs : "pip install web2py"
it will read your db.py models from the same directory
'''
# web2py env
from gluon.shell import exec_environment
import psycopg2
from gluon import DAL, Field
from gluon.template import render
@kkappel
kkappel / mk-lslr.sh
Created September 15, 2015 12:08
Create and update Index file of filesystem like old ftp servers
#!/bin/sh
# Create an Index File like in old ftp servers
# use it for your external hd's to share content
# expl. Video or MP3 Collections
cd .
ls -lR -Ils-lR > ls-lR
cp -a ls-lR.gz ls-lR.old.gz
gzip -d ls-lR.old.gz
@kkappel
kkappel / jpeg2mp4.sh
Created September 15, 2015 12:10
create mpeg4 video out of a batch of jpeg files
#!/bin/sh
# create mpg video from jpegs
# Resolution: FullHD (1080i)
# Orientation: Portrait
#
# tested with Ubuntu 14.04
# dependencies: sudo apt-get install imagemagick avconv
# (c) 2015 by Klaus Kappel <kkappel@novalisa.net>
# use under conditions of the GPL2, see http://www.gnu.org
@kkappel
kkappel / odf2html.sh
Last active June 5, 2019 23:18
export all LibreOffice or MS-Word files to html, uses OpenOffice or Libre Office and tidy
#!/bin/bash
# odf2html.sh - export all odt od doc files to html by shellscript
# Inspired by Marco Fioretti,
# who wrote this Article in 2012: http://www.techrepublic.com/blog/linux-and-open-source/how-to-convert-doc-and-odf-files-to-clean-and-lean-html/
# Klaus Kappel
CONFIG=tidy.conf
# first clean the dir, if script runs in cron job
# rm -rf $2
@kkappel
kkappel / resize.sh
Created September 15, 2015 12:18
resize jpeg images in current folder with ImageMagick
#!/bin/sh
# resize jpeg images in current folder with ImageMagick
#
# (c) 2014 by Klaus Kappel
# directory where target files are located
TARGET=mini
# Size of target images: 1280x1024 or 1280 (x = horizontal size)
SIZE=1280
# Type (suffix) of Source Images: JPG, png, tif, etc.
@kkappel
kkappel / jhwnotebook.sh
Last active July 28, 2022 07:48
Steps to get a brand new business notebook with openvpn running
#!/bin/bash
# Lokalisieren eines Juhiwue-Notebooks oder Desktops
#
# Usage: wget
# Für UBUNTU 16.04
# (c) 2017 by Klaus Kappel <kkappel@yahoo.de>
# Sind wir in Rehr?
INTERN=1
def GetWeek(week_nr, year):
'''
Get start datetime and end datetime of calender week.
Beginning with Monday, ending with Sunday.
Needed for SQL-Queries.
'''
montag = str(week_nr) + "-" + str(year) + '-1'
monday = datetime.strptime(montag, '%W-%Y-%w')
sonntag = str(week_nr) + "-" + str(year) + '-0'
@kkappel
kkappel / nrpe-chkraid.py
Created August 10, 2017 21:12
Check HP Smart Array SATA RAID Controller by nrpe
#!/usr/bin/python
# -*- coding:utf-8 -*-
####
#
# NAME: check_smartarray.py
#
# AUTHOR: Christophe Robert - christophe °dot° robert °at° cocoche °dot° fr
#
# DESC: Check Hpacucli results for RAID status on Linux - hpacucli command line tool
# Prepare OpenWrt for local developement of binaries
# for TP-Link WRT3600
# by Klaus Kappel <kkappel@yahoo.de>
# ABSOLUTELY NO WARRANTY FOR ANY DAMAGE TO YOUR ROUTER
sudo apt update
sudo apt install build-essential subversion libncurses5-dev zlib1g-dev gawk gcc-multilib flex git-core gettext
sudo apt install quilt lzop libssl-dev
git clone git://git.openwrt.org/openwrt.git
cd openwrt
#!/bin/bash
# Migrate from OwnCloud to NextCloud
# tested with: UBUNTU 16.04
# (c) 2017 by Klaus Kappel <kkappel@yahoo.de>
# UBUNTU 16.04, UBUNTU 14.04: apt-get
apt=apt
sudo -s
$apt remove owncloud-client