Skip to content

Instantly share code, notes, and snippets.

View niccokunzmann's full-sized avatar

Nicco Kunzmann niccokunzmann

View GitHub Profile
@niccokunzmann
niccokunzmann / RemoteException.py
Last active March 24, 2024 16:02
See the traceback of the error occurring from the other process with multiprocessing.
import sys
import traceback
import StringIO
from copy_reg import dispatch_table, pickle
def exc_info(hide_calls = 0):
'''as sys.exc_info() but returns a remote exception object'''
ErrorType, thrownError, traceback = sys.exc_info()
for i in range(hide_calls):
@niccokunzmann
niccokunzmann / DecodeLargeJSON.py
Last active October 10, 2023 18:17
Decode large json files
"""
Response to
http://stackoverflow.com/a/22904200/1320237
"""
import json.scanner
import json.decoder
from json.decoder import JSONDecoder
class FileString(object):
@niccokunzmann
niccokunzmann / hanging_threads.py
Last active September 27, 2023 08:13
This module prints all hanging threads that are dead locked. It is for Python 2 and 3. Installable: https://pypi.python.org/pypi/hanging_threads
## The MIT License (MIT)
## ---------------------
##
## Copyright (C) 2014 Nicco Kunzmann
##
## https://gist.github.com/niccokunzmann/6038331
##
## Permission is hereby granted, free of charge, to any person obtaining
## a copy of this software and associated documentation files (the "Software"),
@niccokunzmann
niccokunzmann / example.py
Last active March 1, 2023 15:52
You can use while and for loops without blocking the GUI. This is currently for Tkinter and PyQT. To install guiLoop copy the guiLoop.py file into the directory of your script.
## MIT License
##
## Copyright 2014 Nicco Kunzmann
##
## Permission is hereby granted, free of charge, to any person obtaining a copy of this
## software and associated documentation files (the "Software"), to deal in the Software
## without restriction, including without limitation the rights to use, copy, modify, merge,
## publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
## to whom the Software is furnished to do so, subject to the following conditions:
##
@niccokunzmann
niccokunzmann / RecursiveThreadPoolExecutor.py
Last active June 16, 2021 02:08
The RecursiveThreadpoolExecutor enables the use of futures in the functions that are parallely executed.
'''
This is crated as an answer to the stackoverflow qustion:
http://stackoverflow.com/questions/21960514/can-i-use-a-processpoolexecutor-from-within-a-future
The updated code can be found here:
https://gist.github.com/niccokunzmann/9170072
The RecursiveThreadPoolExecutor allows the usage of futures in the
submitted functions.
It uses the yield and yield from statements to suspend the execution of the
@niccokunzmann
niccokunzmann / example-output-dudle.txt
Last active February 11, 2019 08:12
Export respondent answers from survey monkey 2018-may-12 and compute the maximum participant number for 2 or more chosen dates.
user@programming:~/gists/subset$ ./find-biggest-common-subset-dudle.py # nur Ja, 3 Termine
total: 1331
17 22.02, 08.03, ... Fr ger. W. & 25.02, 11.03, ... Mo ungerade Wochen & 27.02, 13.03, ... Mi wie bisher common: An 2 Terminen können 6 Leute. An 3 Terminen können 1 Leute.
17 26.02, 12.03 Die ung. W. & 27.02, 13.03, ... Mi wie bisher & _01.03, 15.03, ... Fr ung. W. common: An 2 Terminen können 9 Leute. An 3 Terminen können 1 Leute.
17 25.02, 11.03, ... Mo ungerade Wochen & 27.02, 13.03, ... Mi wie bisher & _01.03, 15.03, ... Fr ung. W. common: An 2 Terminen können 5 Leute. An 3 Terminen können 2 Leute.
17 22.02, 08.03, ... Fr ger. W. & 26.02, 12.03 Die ung. W. & 27.02, 13.03, ... Mi wie bisher common: An 2 Terminen können 10 Leute.
16 18.02, 04.03, ... Mo gerade Wochen & 27.02, 13.03, ... Mi wie bisher & _01.03, 15.03, ... Fr ung. W. common: An 2 Terminen können 4 Leute. An 3 Terminen können 1 Leute.
16 22.02, 08.03, ... Fr ger. W. & 23.02, 09.03, ... Sa ger. W. & 27.02, 13.03, ... Mi wi
@niccokunzmann
niccokunzmann / olsr.py
Created April 6, 2018 15:42
Send olsr name service announcements with Python.
"""
This module allows sending OLSR v1 messages to announce host names.
You can find more information here:
https://github.com/servalproject/olsr/blob/master/lib/nameservice/README_NAMESERVICE
"""
import struct
import socket
import requests
print(requests.get("http://owncloud.quelltext.eu").text)
# see https://packaging.python.org/appveyor/#adding-appveyor-support-to-your-project
environment:
PYPI_USERNAME: niccokunzmann3
PYPI_PASSWORD:
secure: Gxrd9WI60wyczr9mHtiQHvJ45Oq0UyQZNrvUtKs2D5w=
# For Python versions available on Appveyor, see
# http://www.appveyor.com/docs/installed-software#python
# The list here is complete (excluding Python 2.6, which
# isn't covered by this document) at the time of writing.
@niccokunzmann
niccokunzmann / download.py
Last active July 7, 2016 20:52
This script downloads all the mp4 files for a tele-task course
#!/usr/bin/python3
## The MIT License (MIT)
##
## Copyright (c) 2014 Nicco Kunzmann
##
## https://gist.github.com/niccokunzmann/9c60cb40d3d3975ef830
##
## Permission is hereby granted, free of charge, to any person obtaining a copy
## of this software and associated documentation files (the "Software"), to deal