Skip to content

Instantly share code, notes, and snippets.

View Desttro's full-sized avatar

Desttro

  • Czech Republic
View GitHub Profile
@Desttro
Desttro / try-finally-yield.py
Created March 17, 2022 06:14 — forked from TFlexSoom/try-finally-yield.py
Try Finally Testing With Asynchronous and Synchronous Generators
import time
import logging
import asyncio
def get_generator():
try:
yield "hello there!"
finally:
logging.info("Finally Block Has Been Run!")
@Desttro
Desttro / models.py
Last active March 11, 2022 02:22
django + strawberry
from django.db import models
class Post(models.Model):
title = models.CharField(max_length=128)
slug = models.SlugField(unique=True, editable=False)
content = models.TextField() # markdown
thumbnail = models.ImageField(upload_to='%Y/%m/%d/', width_field='width', height_field='height')
width = models.PositiveIntegerField(editable=False)
height = models.PositiveIntegerField(editable=False)
@Desttro
Desttro / Protonmail.md
Created October 30, 2021 12:07 — forked from githubcom13/Protonmail.md
Configure the protonmail bridge linux client on Ubuntu 20.04 and Debian 10 server

Protonmail on Ubuntu 20.04 and Debian 10 server

#protonmail #debian #linux

Before you start

Currently protonmail bridge for linux is distributed as part of an open beta program, but soon it will be made public (https://protonmail.com/bridge/install).

Consider that the bridge linux client requires a paid protonmail account to work.

Get the protonmail bridge linux installer

@Desttro
Desttro / axis-headers.js
Created August 6, 2021 09:00 — forked from paltman/axis-headers.js
override axios default csrf header and cookie name to match what Django expects
var axios = require("axios");
var axiosDefaults = require("axios/lib/defaults");
axiosDefaults.xsrfCookieName = "csrftoken"
axiosDefaults.xsrfHeaderName = "X-CSRFToken"

Disable Device Enrollment Program (DEP) notification on macOS Catalina.md

With full reinstall (recommended)

   a. Boot into recovery using command-R during reboot, wipe the harddrive using Disk Utility, and select reinstall macOS

   b. Initial installation will run for approximately 1 hour, and reboot once

   c. It will then show a remaining time of about 10-15 minutes

@Desttro
Desttro / multiprocess_selenium.py
Created February 15, 2021 11:10 — forked from wooddar/multiprocess_selenium.py
Easy Python script to run selenium web workers/browsers in parallel
"""
This is an adaptable example script for using selenium across multiple webbrowsers simultaneously. This makes use of
two queues - one to store idle webworkers and another to store data to pass to any idle webworkers in a selenium function
"""
from multiprocessing import Queue, cpu_count
from threading import Thread
from selenium import webdriver
from time import sleep
from numpy.random import randint