Skip to content

Instantly share code, notes, and snippets.

View DocMinus's full-sized avatar

Alex M. DocMinus

  • RISE AB, Södertälje as well as private
  • Stockholm, Sweden
  • 03:33 (UTC +02:00)
View GitHub Profile
@DocMinus
DocMinus / analyze_nested_structure.py
Created August 22, 2024 09:14
Analyze unknown nested structure (e.g. list of dictionary of whatever...). In Python
from typing import Dict, List, Set, Tuple, Union
import json
def analyze_nested_structure(
variable: Union[List, Dict, Tuple, Set], indent: int = 0
) -> None:
"""
A generic (recursive) function to analyze the structure of a nested list, dictionary, tuple, or set.
comment out the recursive call to avoid printing large content as required.
"""
@DocMinus
DocMinus / rdkit_SVG_images_in_memory.ipynb
Created January 20, 2023 16:06
Python SVG images in memory without using temp files
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@DocMinus
DocMinus / environmnet.yml
Created May 4, 2021 09:02
Allround conda chemistry centric ML & AI environment
name: allround
channels:
- anaconda
- conda-forge
- defaults
dependencies:
- python=3.8
- anaconda
- pip
- tensorflow-gpu
@DocMinus
DocMinus / argparse_in_jupyter.ipynb
Created March 24, 2021 13:29
Argparse in Jupyter Notebook
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@DocMinus
DocMinus / tf_GPU_vs_CPU.py
Last active March 22, 2021 09:29
Tensorflow Cuda GPU vs CPU
#!/usr/bin/env python3
# coding: utf-8
# Test Cuda availability and benchmark CPU vs GPU
#
# see for example: https://colab.research.google.com/notebooks/gpu.ipynb
import tensorflow as tf
import timeit
@DocMinus
DocMinus / keep_awake.pyw
Created February 13, 2021 11:59
Prevent Windows from sleeping (i.e. keep system awake)
import tkinter as tk
import ctypes
import sys
class myBox(tk.Tk):
'''Prevents a Windows system from sleeping by keeping the screen alive.
At the same time an excercise in using tkinter....
(Python 3)
Inspired by multiple code snippets on the net, certainly the
SetThreadExecutionState gimmick.