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 <vector> | |
#include <list> | |
using namespace std; | |
// N - длина стержня, costs[i] - стоимость отрезка длины i+1 | |
vector<size_t> GetCuts(size_t N, const vector<int>& costs) { | |
// элемент односвязного списка | |
struct Node { | |
size_t cutlength; | |
list<Node>::iterator next; |
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
def ChunksToLines(reader): | |
history = [] | |
for chunk in reader: | |
lines = chunk.splitlines() | |
if chunk[-1] == '\n': | |
lines.append('') | |
elif len(lines) == 1: | |
history.append(lines[0]) | |
continue | |
history.append(lines[0]) |
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
# Copy contents of CONTAINER volumes to DEST_FOLDER | |
# usage: volcp CONTAINER DEST_FOLDER | |
volcp() ( | |
set -e | |
if [[ -z "$2" ]]; then | |
echo "ERROR: Destination folder must be specified as second argument" >&2 | |
exit 1 | |
fi | |
echo " To mount volumes please run:" | |
echo "docker run \\" |
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 re | |
import sys | |
from ipaddress import IPv4Network | |
iterbytes = lambda b: (b[i:i+1] for i in range(len(b))) | |
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.Generic; | |
using System.Globalization; | |
using System.Linq; | |
namespace ConsoleApp1 | |
{ | |
class Program | |
{ | |
static void Main(string[] args) |
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 python | |
# -*- coding: utf-8 -*- | |
import scipy.io.wavfile | |
import scipy.signal | |
import subprocess | |
import tempfile | |
ffmpeg = "avconv" |
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
<VirtualHost *:80> | |
Alias "/.well-known" "/var/www/html/.well-known" | |
# redirect other paths to https | |
RewriteEngine On | |
RewriteCond %{REQUEST_URI} !/.well-known/.* | |
RewriteCond %{HTTPS} !=on | |
RewriteRule ^/?(.*) https://%{SERVER_NAME}/ [R,L] | |
</VirtualHost> | |
<VirtualHost *:443> |
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
Microsoft (R) Macro Assembler Version 14.15.26732.1 11/03/18 17:47:56 | |
test.asm Page 1 - 1 | |
.386 | |
.MODEL flat, stdcall | |
OPTION casemap: none | |
00000000 .CONST | |
00000000 2A label1 DB 42 |
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
template<typename ... TArgs> | |
void prn() { | |
((cout << typeid(TArgs).name() << endl), ...); | |
}; | |
template<typename Function> | |
struct f; | |
template<typename TReturn, typename... TArgs> |
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
/* | |
class UsageSample { | |
public DistributedCacheUpdater _cache; | |
async Task<JObject> GetResponse(HttpRequestMessage httpRequest, DistributedCacheEntryOptions cacheOptions, CancellationToken ct) { | |
using (var proxy = await DistributedCacheUpdater.RequestAsync(_cache, httpRequest.RequestUri.ToString(), ct)) { | |
string responseData; | |
if (proxy.Value == null) { | |
_metrics.Measure.Meter.Mark(_cacheHits, "nohit"); | |
using (var httpResponse = await _client.SendAsync(httpRequest, HttpCompletionOption.ResponseContentRead, ct)) { |
OlderNewer