Skip to content

Instantly share code, notes, and snippets.

View s-m-e's full-sized avatar
🌍
on planet earth, galactic sector zz plural z alpha

sme s-m-e

🌍
on planet earth, galactic sector zz plural z alpha
View GitHub Profile
@s-m-e
s-m-e / wineissue.sh
Created December 28, 2022 13:05
Trigger Python import "module not found" when importing submodule from linked package on Wine 7.22 staging
#!/bin/bash
# 3.7.9 triggers the bug, 3.10.9 does not
MAJOR=3
MINOR=7
MAINTANANCE=9
PYTHONARCH=amd64 # options: win32, amd64
export WINEARCH=win64 # options: win32, win64
@s-m-e
s-m-e / shared_memory_tests.py
Last active July 28, 2021 05:07
Pure Python & Numpy openMP-style for-loop based on POSIX shared memory and forks for Unix-like systems
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
SHARED MEMORY TESTS
Pure Python & Numpy openMP-style for-loop based on POSIX shared memory
and forks for Unix-like systems (tested on Linux)
Copyright (C) 2021 Sebastian M. Ernst <ernst@pleiszenburg.de>
from bewegung import Video, FFmpegGifEncoder
from multiprocessing import cpu_count
from random import gauss
FRAMES = 300
def data(length, *args, **kwargs):
state = 0
for _ in range(length):
@s-m-e
s-m-e / mptest.py
Last active August 22, 2021 09:41
multiprocessing pool test, process-based and thread-based
# -*- coding: utf-8 -*-
# QGIS 3.x / Python 3.x
from math import sqrt, ceil
from multiprocessing import Pool, Process, Queue
from multiprocessing.pool import ThreadPool
WORKERS = 2
def worker_task(number):
@s-m-e
s-m-e / poliastro_benchmark.ipynb
Last active September 3, 2020 14:05
poliastro benchmark
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@s-m-e
s-m-e / cairo_test.py
Last active September 26, 2023 17:59
A simple script for generating individual frames of an animation
import cairo
import math
import os
class Image:
def __init__(self, width, height, background_color = (1.0, 1.0, 1.0)):
self._width, self._height = width, height
self._surface = cairo.ImageSurface(cairo.FORMAT_RGB24, self._width, self._height)
self._ctx = cairo.Context(self._surface)
self._set_background_color(background_color)
@s-m-e
s-m-e / download_www_logs_from_hetzner.py
Created January 5, 2020 10:10
Download & updating "www_logs" from Hetzner's web hosting service (for cron jobs)
#!/usr/bin/env python
# Python 3
import datetime
import gzip
import os
import stat
import pysftp # pip install pysftp==0.2.8
@s-m-e
s-m-e / download_pypi_package_stats.py
Last active January 5, 2020 10:04
Download PyPI statistics for all packages of one user (maintainer and/or owner)
#!/usr/bin/env python
# Python >= 3.6
import datetime
import json
import os
import xmlrpc.client
import requests # pip install requests
@s-m-e
s-m-e / download_github_organization_stats.py
Created January 5, 2020 09:55
Download basic statistics for all repositories in list of GitHub organizations
#!/usr/bin/env python
# Python 3
import datetime
import json
import os
from github import Github # pip install PyGithub
ORGANIZATIONS = ['my_organization', 'some_other_organization']
@s-m-e
s-m-e / daemonocle_status_check.py
Created December 1, 2017 11:37
Script for programmatically checking weather a daemonocle daemon is up or down
# Script for programmatically checking weather a daemonocle daemon is up or down
# -> see: https://github.com/jnrbsn/daemonocle
# -> works around the following issue: https://github.com/jnrbsn/daemonocle/issues/18
# -> requires knowledge of the location of the daemon's pid file
# -> tested with CPython 3.6
# Licenced under the MIT License (MIT)
# Copyright (c) 2017 @s-m-e
import os