This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from http.client import HTTPResponse | |
import urllib.parse | |
import asyncio | |
import json | |
import sys | |
import io | |
class FakeSocket: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local get_basename = function(path) | |
return path:match('/([^/]*)$') or path | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function doMagic(obj) { | |
return new Proxy(obj, { | |
construct: (target, args) => { | |
return doMagic(new target(...args)) | |
}, | |
get: (target, name) => { | |
let prop = Reflect.get(target, name) | |
if (typeof prop === 'function') { | |
return prop.bind(target) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
from abc import ABC, ABCMeta, abstractmethod | |
from types import FunctionType | |
from collections import OrderedDict | |
# flake8: noqa | |
class UnresolvedFreeVarsError(Exception): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
# Tool to create (and optionally install) Debian packages of i3 with | |
# window icons patch. | |
# Based on i3-gaps-deb by Gerhard A. Dittes | |
# Copyright (C) 2017 Gerhard A. Dittes | |
# | |
# This program is free software: you can redistribute it and/or modify |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- {templates_dir}/admin/base_site.html --> | |
{% extends "admin/base.html" %} | |
{% load i18n %} | |
{% block title %}{{ title }} | {{ site_title|default:_('Django site admin') }}{% endblock %} | |
{% block branding %} | |
<h1 id="site-name"><a href="{% url 'admin:index' %}">{{ site_header|default:_('Django administration') }}</a></h1> | |
{% endblock %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def zip_trim(i1, i2, trim='shortest', default=None): | |
''' trim = 'shortest' | 'longest' | 'first' | 'second' | |
''' | |
i1_iter = iter(i1) | |
i2_iter = iter(i2) | |
while True: | |
stop = False | |
try: | |
e1 = next(i1_iter) | |
except StopIteration: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django import forms | |
from django.utils.safestring import mark_safe | |
from django.core.urlresolvers import reverse | |
class InstanceLinkWidget(forms.Widget): | |
def __init__(self, obj, attrs=None): | |
self.obj = obj | |
super(InstanceLinkWidget, self).__init__(attrs) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UniqMixin: | |
def uniq(self): | |
uniq_list = [] | |
for el in self: | |
if el not in uniq_list: | |
uniq_list.append(el) | |
return self.__class__(uniq_list) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
iptables -A INPUT -p udp --sport 53 --match string --algo bm --hex-string '|5cfff164|' -j DROP | |
iptables -A INPUT -p tcp --sport 80 --match string --algo bm --string 'Location: http://lawfilter.ertelecom.ru' -j DROP |