Skip to content

Instantly share code, notes, and snippets.

View hgross's full-sized avatar

Henning Groß hgross

View GitHub Profile
@hgross
hgross / error_response.json
Created January 12, 2012 16:05
Traceback of PUT on a toManyField
{"error_message": "int() argument must be a string or a number, not 'list'", "traceback": "Traceback (most recent call last):
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/tastypie/resources.py", line 178, in wrapper
response = callback(request, *args, **kwargs)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/tastypie/resources.py", line 379, in dispatch_list
return self.dispatch('list', request, **kwargs)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/tastypie/resources.py", line 409, in dispatch
response = method(request, **kwargs)
@hgross
hgross / 0_Xamarin.Forms_CustomFonts.md
Last active February 17, 2016 09:50
Using custom fonts with Xamarin.Forms on iOS and Android (FontAwesome example)

Adding Fonts (FontAwesome-Example)

  1. Add the font file as an asset to all platforms.
  2. Find the names of the icons you want to use at https://fortawesome.github.io/Font-Awesome/icons/
  3. Use them with inline XAML or DataBinding - A corresponding mapping for FontAwesome 4.5 icons is attached (FontAwesomeMapping.cs) as well as a python script to generate this mapping from the FontAwesome css file (create_unicode_mapping.py).

FontAwesome in Xamarin.Forms app

Add font file to iOS

@hgross
hgross / gist:26042d052f58feeb6d1b329e8dd2dfcc
Created February 19, 2018 17:42
Change docker_gwbridge subnet address
## Do this on each swarm-node
# store containers attached to the bridge
$ gwbridge_users=$(docker network inspect --format '{{range $key, $val := .Containers}} {{$key}}{{end}}' docker_gwbridge | \
$ xargs -d' ' -I {} -n1 docker ps --format {{.Names}} -f id={})
# stop all containers
# if you have stacks that restart automatically, remove them via docker stack <stackName> rm
$ echo "$gwbridge_users" | xargs docker stop
$ docker network rm docker_gwbridge
$ docker network disconnect -f docker_gwbridge gateway_ingress-sbox
@hgross
hgross / octoprint.log
Created January 7, 2019 20:26
octoprint restore issue with basedir on docker-mounted volume
2019-01-07 19:54:51,558 - octoprint.startup - INFO - ******************************************************************************
2019-01-07 19:54:51,561 - octoprint.startup - INFO - Starting OctoPrint 1.3.10
2019-01-07 19:54:51,563 - octoprint.startup - INFO - ******************************************************************************
2019-01-07 19:54:51,714 - octoprint.plugin.core - INFO - Loading plugins from /usr/local/lib/python2.7/dist-packages/OctoPrint-1.3.10-py2.7.egg/octoprint/plugins, /data/octorpint-data/plugins and installed plugin packages...
2019-01-07 19:54:54,705 - octoprint.plugins.discovery - INFO - pybonjour is not installed, Zeroconf Discovery won't be available
2019-01-07 19:54:54,720 - octoprint.plugin.core - INFO - Found 23 plugin(s) providing 23 mixin implementations, 33 hook handlers
2019-01-07 19:54:54,725 - octoprint.server.heartbeat - INFO - Starting server heartbeat, 900.0s interval
2019-01-07 19:54:55,233 - octoprint.server - INFO - Intermediary server started
2019-01-07 19
@hgross
hgross / generate-ssh-key.sh
Created August 13, 2019 13:13 — forked from grenade/01-generate-ed25519-ssh-key.sh
Correct file permissions for ssh keys and config.
ssh-keygen -t rsa -b 4096 -N '' -C "rthijssen@gmail.com" -f ~/.ssh/id_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "rthijssen@gmail.com" -f ~/.ssh/github_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "rthijssen@gmail.com" -f ~/.ssh/mozilla_rsa
@hgross
hgross / throttle-poorly-made-software.sh
Last active February 27, 2020 06:56 — forked from golimpio/egos_throttle.sh
Run cputhrottle for a list of applications in order to limit their CPU usage.
#!/bin/bash
# requires cputhrottle and pidof
# $ sudo port intall cputhrottle pidof
# or
# $ brew install cputhrottle pidof
# Run cputhrottle for a list of applications in order to limit their CPU usage.
# This script needs `pidof` and `cputhrottle` installed, which can be installed from homebrew.
@hgross
hgross / fix-graphviz-for-PlantUML.sh
Last active August 5, 2020 16:52
Downgrade/install graphviz 2.38.0 via MacPorts to resolve PlantUML issues
#!/bin/bash
# PlantUML has "a lot of issues" with graphviz greater 2.38.0 (screwed up layouts and more, check the official PlantUML site)
# so we need to get the old port file
# I tested this with Mac OS 10.15.6
# the update to 2.40.1 was done by this commit https://github.com/macports/macports-ports/commit/937422eaee9e592a79b631ee20cecdbbe33a7375, so the parent on the master is c11df6b3e4867171fff9438ba499e20f31b449e8
# uninstall the current version first - note this might break other things ;-)
sudo port uninstall graphviz
@hgross
hgross / codesign-ms-teams-to-work-with-webcams.sh
Created April 22, 2021 09:26
Manipulate MS Teams code signing on Mac OS to use a (non-internal) webcam in Teams
#!/bin/bash
MS_TEAMS_PATH="/Applications/Microsoft\ Teams.app"
echo "Going to remove the MS teams signature from MS teams to allow detection by the MS Teams CoreMediaIO plugin ..."
echo "See https://answers.microsoft.com/en-us/msteams/forum/msteams_tfb-msteams_tfmac/microsoft-teams-mac-os-client-is-not-recognizing/d9e863be-d9a4-4d03-a4b8-1b5c7df58828 for details."
echo "Expecting xcode-select --install has been executed after the latest major MacOS update ..."
sudo codesign --remove-signature "/Applications/Microsoft Teams.app" &&\
sudo codesign --remove-signature "/Applications/Microsoft Teams.app/Contents/Frameworks/Microsoft Teams Helper.app" &&\
@hgross
hgross / README.md
Created August 16, 2021 11:56
This is a minimal sql query to extract the most important information of the FilamentManager OctoPrint plugin's sqlite datbase file to a SpoolManager importable CSV file..

OctoPrint: FilamentManager to SpoolManager conversion

This is a minimal sql query to extract the most important information of the FilamentManager OctoPrint Plugin's sqlite datbase file to a SpoolManager importable CSV file.

Steps:

  1. The FilamentManager database file can be extracted from an OctoPrint backup (zip-)file. The path in the backup file shoud be basedir/data/filamentmanager/filament.db.
  2. Use a tool like (DB Browser for SQLite)[https://sqlitebrowser.org/dl/] (or similar) to open the FilamentManager database file
  3. Execute convert_filamentmanager_db_to_spoolmanager.sql and export the result as CSV.
  4. Use the SpoolManager import function with the exported CSV (From OctoPrint settings).

Home Assistant blueprint for Tuya TS004F via Zigbee2MQTT

I had to fork this to

  • fix a naming issue with certain friendly names (slashes)
  • use parallel mode instead of single mode (see docs)
  • Fix some z2mqtt breaking changes after upgrading z2mqtt (actions are mapped differently)

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

Coniguration