This file contains 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
public static class HostedServicesExtensions { | |
private class HostedMultiService<THostedService> : IHostedService where THostedService : class, IHostedService { | |
readonly THostedService[] _hostedServices; | |
public HostedMultiService(IEnumerable<THostedService> hostedServices) { | |
_hostedServices = hostedServices.ToArray(); | |
if (_hostedServices.Any(s => s == null)) | |
throw new ArgumentNullException(nameof(hostedServices)); | |
} |
This file contains 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
/* | |
// * Summary * | |
BenchmarkDotNet=v0.13.0, OS=Windows 10.0.19042.1052 (20H2/October2020Update) | |
Intel Core i7-6600U CPU 2.60GHz (Skylake), 1 CPU, 4 logical and 2 physical cores | |
.NET SDK=6.0.100-preview.4.21255.9 | |
[Host] : .NET 6.0.0 (6.0.21.25307), X64 RyuJIT | |
DefaultJob : .NET 6.0.0 (6.0.21.25307), X64 RyuJIT | |
This file contains 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
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Linq; | |
using System.Text; | |
namespace DHT { | |
public class Bencoder { |
This file contains 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 | |
# -*- coding: utf-8 -*- | |
# slavanap@gitlab | |
def subprocess(func): | |
def wrapper(v, kv, w): | |
w.send(func(*v, **kv)) | |
w.close() | |
import multiprocessing | |
def realfunc(*vargs, **kvargs): |
This file contains 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
/* | |
MIT license | |
Copyright 2020 Vyacheslav Napadovsky. | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is |
This file contains 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 alpine | |
RUN apk add iptables | |
CMD /sbin/sysctl -w net.ipv4.conf.all.route_localnet=1 \ | |
&& /sbin/iptables -t nat -A PREROUTING -p tcp -d 169.254.170.2 --dport 80 -j DNAT --to-destination 127.0.0.1:51679 \ | |
&& /sbin/iptables -t nat -A OUTPUT -d 169.254.170.2 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 51679 \ | |
&& sleep 100000000000000 | |
# docker build -t ecs-init -f ecs-init.dockerfile . | |
# docker run --name ecs-init -d --restart=always --net=host --privileged ecs-init | |
# docker run --name ecs-agent -d --restart=always --volume=/var/run:/var/run --volume=/var/log/ecs/:/log --volume=/var/lib/ecs/data:/data --volume=/etc/ecs:/etc/ecs --net=host --env-file=/etc/ecs/ecs.config amazon/amazon-ecs-agent |
This file contains 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
#include <stdlib.h> | |
#include <stdio.h> | |
#include <iostream> | |
#include <sstream> | |
#include <limits> | |
using namespace std; | |
int main() { | |
char buf [100]; |
This file contains 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 | |
# -*- coding: utf-8 -*- | |
import hashlib | |
import os | |
import os.path | |
import pickle | |
import sys | |
This file contains 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 ubuntu:bionic | |
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 DEBIAN_FRONTEND=noninteractive | |
RUN apt-get update -qq && apt-get install -qqy --no-install-recommends \ | |
bc bison build-essential ccache curl flex g++-multilib gcc-multilib git gnupg gperf imagemagick lib32ncurses5-dev lib32readline-dev lib32z1-dev \ | |
liblz4-tool libncurses5-dev libsdl1.2-dev libssl-dev libwxgtk3.0-dev libxml2 libxml2-utils lzop pngcrush rsync schedtool squashfs-tools xsltproc \ | |
zip zlib1g-dev \ | |
ca-certificates wget unzip python \ | |
simg2img openjdk-8-jdk |
This file contains 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
using Microsoft.Extensions.Caching.Memory; | |
using Newtonsoft.Json.Linq; | |
using System; | |
using System.Collections.Generic; | |
namespace ConsoleApp3 { | |
public class Box<T> { | |
public T Value; | |
public Box(T value) { | |
Value = value; |
NewerOlder