Skip to content

Instantly share code, notes, and snippets.

Avatar

Jens Diemer jedie

View GitHub Profile
@jedie
jedie / Vagrantfile
Last active Jan 17, 2022
Setup YunoHost "package check" via Vagrant in a Virtual box
View Vagrantfile
# https://docs.vagrantup.com
# https://github.com/YunoHost/package_check
Vagrant.configure("2") do |config|
# https://app.vagrantup.com/ubuntu/boxes/focal64
config.vm.box = "ubuntu/focal64"
config.vm.provider "virtualbox" do |vb|
@jedie
jedie / mitm-redirect.py
Created Jan 2, 2022
Web Server to redirect YouTube to invidious ... But is practically unusable because the browser rejects the self-signed certificate ;)
View mitm-redirect.py
import asyncio
import random
import ssl
from asyncio import StreamReader, StreamWriter
from pathlib import Path
from OpenSSL import crypto
BASE_PATH = Path(__file__).parent
View gist:f642ab340506682c86d168daf4017fd1
...
Collecting xlwt==1.3.0
Downloading https://www.piwheels.org/simple/xlwt/xlwt-1.3.0-py2.py3-none-any.whl (99 kB)
|████████████████████████████████| 99 kB 1.8 MB/s
Requirement already satisfied: setuptools in ./local_test/venv/lib/python3.7/site-packages (from django-axes==5.27.0->-r ./conf/requirements.txt (line 37)) (40.8.0)
Collecting tablib[html,ods,xls,xlsx,yaml]>=3.0.0
ERROR: In --require-hashes mode, all requirements must have their versions pinned with ==. These do not:
tablib[html,ods,xls,xlsx,yaml]>=3.0.0 from https://www.piwheels.org/simple/tablib/tablib-3.1.0-py3-none-any.whl#sha256=41f3950bb717a7beb857ffe1ed8c18a2ea7dbb8549400446c48ff3533327d407 (from django-import-export==2.6.1->-r ./conf/requirements.txt (line 48))
View zoom-install.sh
#!/bin/bash
set -ex
cd /tmp
wget --timestamp https://www.zoom.us/client/latest/zoom_amd64.deb
sudo dpkg -i zoom_amd64.deb
@jedie
jedie / benchmark-rest-api.py
Created Feb 5, 2020
Benchmark Django REST-Framework
View benchmark-rest-api.py
import cProfile
import pstats
import time
from collections import OrderedDict, namedtuple
import django
import rest_framework
from django.conf import settings
from django.test import RequestFactory
from rest_framework.response import Response
View benchmark-tartiflette.py
import asyncio
import cProfile
import pstats
import time
from collections import OrderedDict, namedtuple
from tartiflette import Resolver, create_engine
Entry = namedtuple('Entry', 'id name')
@jedie
jedie / benchmark_graphql_core.py
Last active Feb 5, 2020
Benchmark graphql-core
View benchmark_graphql_core.py
import cProfile
import pstats
import statistics
import time
import timeit
from collections import OrderedDict, namedtuple
import graphql
from graphql.graphql import execute_graphql
from graphql.type import (
View gist:35e256e80358f5e0a5e16f6bbff6fa34
Watchdog.garbage_collection():
freed up 608 bytes -> 3088 bytes free
Traceback (most recent call last):
File "src/webswitch.py", line 108, in request_handler
File "src/webswitch.py", line 99, in send_response
File "src/webswitch.py", line 78, in call_module_func
File "src/http_set_timer.py", line 31, in get_form
File "src/webswitch.py", line 29, in send_html_page
File "src/device_name.py", line 34, in get_device_name
File "src/config_files.py", line 31, in <module>
View threaded_fs_walk.py
import logging
import os
import random
import threading
import time
# https://github.com/peter-wangxu/persist-queue
from pathlib import Path
import persistqueue
View docdata_facade.py
import logging
from django.core.exceptions import SuspiciousOperation
from oscar_docdata.facade import Facade
from oscar_docdata.models import DocdataOrder
log = logging.getLogger(__name__)