Skip to content

Instantly share code, notes, and snippets.

View daknuett's full-sized avatar
🏠
Working from home

Daniel Knuettel daknuett

🏠
Working from home
View GitHub Profile
@daknuett
daknuett / lattice2ndarray.py
Created June 5, 2024 10:46
Convert GPT's lattices to numpy ndarrays
#
# Copyright(c) 2024 Daniel Knüttel
#
# 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,
#
# Copyright(c) Daniel Knüttel 2022
#
# 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,
@daknuett
daknuett / time_m.hpp
Created May 17, 2021 13:45
C++ preprocessor macros to log the execution time of a block of code
#ifndef time_m_hpp_included_
#define time_m_hpp_included_
//
// Copyright(c) Daniel Knüttel 2020
//
// 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
@daknuett
daknuett / circuit_formatter.py
Created July 6, 2020 15:11
A module for embedding qcircuit code into jupyter notebooks.
#
# Copyright(c) Daniel Knuettel
#
# 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,
@daknuett
daknuett / Dockerfile
Last active May 15, 2020 11:58
Dockerfile for gpt
FROM debian:latest
RUN apt-get update
RUN apt-get install -y gcc cmake libmpfr-dev libgmp-dev git build-essential autoconf
RUN apt-get install -y wget libssl-dev zlib1g-dev
RUN apt-get install -y rpm
RUN apt-get install -y python3 python3-pip
RUN wget https://download.open-mpi.org/release/open-mpi/v4.0/openmpi-4.0.3-1.src.rpm
RUN rpm -i openmpi-4.0.3-1.src.rpm
import requests
import time
import json
url = "https://de.wikipedia.org/w/api.php?action=query&prop=revisions&titles=Jan_B%C3%B6hmermann&rvslots=*&rvprop=timestamp|user|content&rvlimit=max&format=json"
url2 = "https://de.wikipedia.org/w/api.php?action=query&prop=revisions&titles=Jan_B%C3%B6hmermann&rvslots=*&rvprop=timestamp|user|content&rvlimit=max&format=json&rvstart={}"
s = requests.Session()
USE_LOADED_DATA = False
if(not USE_LOADED_DATA):
@daknuett
daknuett / SimpleArithmeticParser.ipynb
Created January 16, 2018 11:08
SimpleArithmeticParser.ipynb -- A Demo Parser written in python3
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@daknuett
daknuett / sphinx-github-doc.make
Last active February 19, 2018 09:26
A simple Makefile to make sphinx html suit github-pages
# Using github-pages with sphinx-build documentation
# is a pain in the ass.
# This makefile solves the problems quickly.
# just add these lines to the "html" rule that sphinx-quickstart
# generated and save this file with the name github-make in
# the folder that contains your sphinx-Makefile:
#
# @echo "Copying files to /docs..."
# if [ -e ../docs ] ;then rm -rf ../docs;fi
@daknuett
daknuett / imgtotext.py
Created February 15, 2017 21:50
Convert Images to text
import shutil, math, sys
import matplotlib.image
import numpy as np
import matplotlib.pyplot as plt
#
# Copyright(c) 2017 Daniel Knüttel
#
# This program is free software.
@daknuett
daknuett / collect_mail.py
Created February 14, 2017 17:21
Send emails to multiple recipients with ease
import smtplib, argparse, json, sys
from email.mime.multipart import *
from email.mime.text import *
"""
Send emails to a lot of receipients with ease.
"""
#