Skip to content

Instantly share code, notes, and snippets.

@georg90
georg90 / Pico_Victron_BT.py
Last active February 8, 2024 18:57
Example of micropython code to read victron SmartShunt 500A
# Pico_Victron_BT.py
#
# © Swâmi Petaramesh 2024
#
# This program is free software: you can redistribute it and/or modify it under the terms
# of the GNU General Public License as published by the Free Software Foundation,
# either version 3 of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
# without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
@georg90
georg90 / ffmpeg.sh
Created April 15, 2020 21:38
Create thumbnails for videos in piwigo remotely if webspace doesn't allow the install of ffmpeg etc.
#!/bin/bash
# find all video files without thumbnail and create thumbnails remotely (I have a nodered API that can receive the video file and return the thumbnail)
# I run this as a cronjob every day
db=""
host=""
user=""
pw=""
remote_ffmpeg=""
mysql -h $host -P 3306 -D$db -u$user -p$pw -se 'SELECT id,path FROM `piwigo_images` where representative_ext is null and right(file,3) = "mp4"' | while read -r id value;
additional power supply 3.3v!!
linux!!
esptool.py
mode dout
esptool.py --port /dev/ttyUSB0 write_flash -fm dout 0x000 ESPEasy_R147_1024.bin -fs 1MB
@georg90
georg90 / crypto_update.py
Created July 22, 2017 14:44
Python code to query cryptocompare for your current holding in USD
#!/usr/bin/python
# Author Georg Peters (georg90@github.com)
import requests
import json
import time
import os
url = 'https://min-api.cryptocompare.com/data/price'
result = 0
@georg90
georg90 / gist:ec6ac5eb04d335f65577164e4dabba76
Last active April 18, 2018 06:40
renew le certificates
# how to renew certificates with nextcloud in place.
sudo -u www-data php /var/www/nextcloud/occ maintenance:mode --on
# wait 5min
sudo service apache2 stop
sudo certbot renew --dry-run # ohne dry-run wenn normaler renewal
sudo -u www-data php /var/www/nextcloud/occ maintenance:mode --off
sudo service apache2 start
@georg90
georg90 / gist:99f5685b6e21679269fc976e26588aac
Created June 8, 2016 09:44
HVV API Geofox proof of concept
#!/usr/bin/python
# coding: utf8
### imports (Pakete evtl. mit "sudo pip install --upgrade requests" installieren!)
import requests
import hmac
#! /bin/bash
#
# Simple backup script for jottacloud and owncloud/git.
# Created by Georg Peters (https://lane6.de)
# Version 1.1
# Previous version at: https://lane6.de/posts/how-to-setup-a-simple-online-backup-with-duply-and-owncloud
# Use: ./backup.sh owncloud
# Check if backup if running
if [[ -f /tmp/backup.running ]]; then
@georg90
georg90 / fail2ban
Created May 19, 2016 05:03
fail2ban init.d script for local install (see https://lane6.de)
#! /bin/sh
### BEGIN INIT INFO
# Provides: fail2ban
# Required-Start: $local_fs $remote_fs
# Required-Stop: $local_fs $remote_fs
# Should-Start: $time $network $syslog iptables firehol shorewall ipmasq arno-iptables-firewall iptables-persistent ferm
# Should-Stop: $network $syslog iptables firehol shorewall ipmasq arno-iptables-firewall iptables-persistent ferm
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start/stop fail2ban
@georg90
georg90 / gist:8d66b096cc09749d3a3a
Created March 24, 2016 09:34
Install duplicity with custom backend
Btw. I compiled the 0.7.06 version (manually), downloaded https://raw.githubusercontent.com/havardgulldahl/jottalib/master/src/duplicity-backend.py into ````duplicity/backends```` renamed it to ````jottabackend.py```` and installed duplicity using ````sudo python setup.py install```` Now I use a duply profile with a pre and post script to set the Environment (````export JOTTACLOUD_USERNAME="username" + JOTTACLOUD_PASSWORD="password"````)
You then have to use ````sudo -E duply ...```` to keep the environment variables.
@georg90
georg90 / upload.html
Last active February 10, 2020 11:24
very simple koken mobile upload script
<!--
Change API Token
Change URL
-->
<html lang="en">
<head>
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/sweetalert/1.1.0/sweetalert.min.js"></script> <!-- for nice alerts -->
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/sweetalert/1.1.0/sweetalert.min.css">
</head>