Skip to content

Instantly share code, notes, and snippets.

import asyncio
import functools
import inspect
from asgiref.sync import async_to_sync
from channels.exceptions import StopConsumer
from channels.generic.websocket import AsyncWebsocketConsumer
from channels.layers import get_channel_layer
from functools import cached_property
from django.urls import URLResolver, URLPattern, ResolverMatch, Resolver404
class MyURLPattern(URLPattern):
def resolve(self, path, method):
if self.method == method:
return super().resolve(path)
"""
This patch is needed due to this BUG: https://code.djangoproject.com/ticket/33716
"""
from django.conf import settings
from django.core.handlers.asgi import ASGIRequest
from django.utils.deprecation import MiddlewareMixin
from django.utils.module_loading import import_string
#TODO on __init__
def is_next_middleware_async_capable(mw):
def exec_query(query_def: str, globals, locals, left_join=False):
cells = None
tree = parse(query_def)
tree = tree.node.nodes[0].expr.code
tree, extractors = create_extractors(tree, globals, locals, special_functions, const_functions)
vars, vartypes = extract_vars(extractors, globals, locals, cells)
node = tree.quals[0].iter
varkey = node.src
origin = vars[varkey]
defmodule Wrapper do
defmacro apply(call, [do: block]) do
{wrapper, _opts, args} = call
func = makefun(do: block)
{wrapper, [], [:wraps, func] ++ args}
end
def makefun(do: block), do:
{:fn, [], [{:->, [], [[], block]}]}
from __future__ import print_function
from zope.interface import implementer
from twisted.internet import ssl, defer
from twisted.mail import smtp
from twisted.cred.portal import IRealm
from twisted.cred.portal import Portal
2019/10/13 14:44:55 [DBG] { "type" : "progress", "currentStep" : 8, "totalSteps" : 8, "stepCompletion" : 96, "stepDescription" : "add_missing_files" },
2019/10/13 14:44:55 [DBG] { "type" : "progress", "currentStep" : 8, "totalSteps" : 8, "stepCompletion" : 97, "stepDescription" : "add_missing_files" },
2019/10/13 14:44:55 [DBG] { "type" : "progress", "currentStep" : 8, "totalSteps" : 8, "stepCompletion" : 98, "stepDescription" : "add_missing_files" },
2019/10/13 14:44:55 [DBG] { "type" : "progress", "currentStep" : 8, "totalSteps" : 8, "stepCompletion" : 99, "stepDescription" : "add_missing_files" },
2019/10/13 14:44:55 [DBG] { "type" : "progress", "currentStep" : 8, "totalSteps" : 8, "stepCompletion" : 100, "stepDescription" : "add_missing_files" },
2019/10/13 14:44:55 [DBG] Target OS: : Task add_missing_files completed
2019/10/13 14:44:55 [DBG] { "type" : "info", "msg" : " Inspected 305965 files " },
2019/10/13 14:44:55 [DBG] { "type" : "info", "msg" : " 4 files were missing " },
2019/10/13 14:44:55 [DBG]
import signal
class TimeoutExpired(Exception):
pass
def alarm_handler(signum, frame):
raise TimeoutExpired
def input_with_timeout(prompt, timeout):
# set signal handler
defmodule MixHi do
def hello do
data = %{kwa: "kush"}
ppln()
|> Enum.reduce(data, fn (x, acc) -> x.(acc) end)
end
def fa %{} = state do
I found this looking around on the net.
Grub2 is capable of directly booting ISO images for many Linux distros if the entries have been properly defined in the Grub2 configuration files.
The ISO image must be placed on a separate partition that does not have an operating system installed on it. For the sake of simplicity, we would place it inside a new directory under /boot (assuming it is on a separate partition).
Create the new directory and copy your ISO image:
sudo mkdir /boot/iso
sudo cp ~/Desktop/name.iso /boot/iso