I hereby claim:
- I am pgcd on github.
- I am pgcd (https://keybase.io/pgcd) on keybase.
- I have a public key ASA-P78BVoVBnB5EQBsnisKQWoM18r_GOW43QGDkWwVBfwo
To claim this, I am signing this object:
Copy disk (eg `disk2vhd` then `Vboxmanage clonemedium`) | |
- access VM commandline (eg. use a win11 installation disk and select "repair" | |
- in the VM use `diskpart` to list volumes, find system one and assign letter=Z | |
- format system volume (`format Z: /q`) | |
- use `bcdboot C:\Windows /s Z:` | |
- reboot VM | |
(https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/bcdboot-command-line-options-techref-di?view=windows-11) |
### In Python 3.10 you can do this: | |
import functools | |
class A: | |
def whoami(self, obj): | |
print(self, obj) | |
class B: | |
pass | |
a = A() | |
setattr(B, "whoami", functools.partialmethod(a.whoami)) |
# Vagrant | |
export VAGRANT_WSL_ENABLE_WINDOWS_ACCESS="1" | |
export PATH=$PATH:/mnt/c/Program\ Files/Oracle/VirtualBox | |
export VAGRANT_WSL_WINDOWS_ACCESS_USER_HOME_PATH="/mnt/c/Users/<Windows Username>" |
import socket | |
hostname = socket.gethostname() | |
PAPERTRAIL_HOST = 'logsN.papertrailapp.com' | |
PAPERTRAIL_PORT = 'XXXXX' | |
LOGGING = { | |
'version': 1, | |
'disable_existing_loggers': False, | |
'handlers': { | |
'SysLog': { | |
'level': 'INFO', |
I hereby claim:
To claim this, I am signing this object:
from compressor.css import CssCompressor | |
class DeferredCssCompressor(CssCompressor): | |
template_name_file = 'deferred_compressed_css.html' |
# usage: python save_all_strms.py gdrive:your_video_folder | |
import os | |
import sys | |
import re | |
from subprocess import Popen, PIPE | |
import logging | |
log = logging.getLogger('save_all_strms') | |
log.addHandler(logging.StreamHandler()) |
from .main import PostProcess | |
def autoload(): | |
return PostProcess() |
# It took me a day to figure out a way of converting the color profile before sending an uploaded image off to S3; | |
# The following works both for in-memory and temp file uploads (MemoryFileUploadHandler and TemporaryFileUploadHandler) | |
import subprocess | |
import logging | |
logger = logging.getLogger('imageprocessing') | |
color_profile = settings.BASE_DIR + 'sRGB.icc' # It should be an absolute path pointing to the icc file | |
f = uploadedfile # eg. the one you get from request.FILES.getlist(field_name) | |
command = ['convert', '-profile', color_profile, '-', '-'] | |
try: |
import pytz | |
import icalendar | |
import datetime | |
def generate_vtimezone(timezone): | |
if not timezone: # UTC as a fallback doesn't work, since it has no transition info | |
return None | |
z = pytz.timezone(timezone) | |
utc = pytz.timezone('utc') | |
dst1, std1, dst2, std2 = filter(lambda x: x[0].year in (datetime.now().year, datetime.now().year + 1), |