Skip to content

Instantly share code, notes, and snippets.

@kirr
kirr / gist:d11020090dace60945dcd83635ec1af2
Created October 15, 2025 08:06
Go integration test example
package integration_test
import (
"adc-backend/config"
"adc-backend/internal/tarantoolx/ttconfig"
"adc-backend/tests/testcontainersx"
"github.com/stretchr/testify/suite"
"github.com/testcontainers/testcontainers-go"
)
REQUEST
&{POST http://88.255.240.242:5161/api/shipmentv4/api.php HTTP/1.1 1 1 map[Content-Type:[text/xml] Soapaction:[urn:server/urn:server#addShipmentVariantJoom]] {<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.
xmlsoap.org/soap/envelope/" xmlns:ns="urn:server" xmlns:tns="urn:server" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><SOAP-ENV:Body><tns:addShipmentVariantJoom><kullanici>DEV-26411057274683399</kull
anici><sifre>a0ca2c33-3068-11ea-b304-005056b8b965</sifre><ptsno>0</ptsno><servis>E</servis><yetkili>Testing Reciever12345678901233456579049045645654635836794856938645967394865934679857643987698436986327693679
865948953</yetkili><sirketadi></sirketadi><adres>Test Street 1-1-1</adres><sehir></sehir><eyalet></eyalet><postakodu>08120</postakodu><ulkekodu>ES</ulkekodu><telefon></telefon><email></email><kimlik_kart_kod>
</kimlik_kart_kod><kimlik_kart_seri></kimlik_kart_seri><kimlik_kart_numara></kimlik_kart_numara><kimlik_kart_tarih></kimlik_kart_tarih><gonderici_yetkili>JoomTest</gonderici_yetkil
curl http://88.255.240.242:5161/api/ptsawb/2250286391_1633031914.pdf
<!-- IE friendly error message walkround.
if error message from server is less than
512 bytes IE v5+ will use its own error
message instead of the one returned by
server. -->
class LinkedList:
class Node:
def __init__(self, v):
self.v = v
self.next = None
def __init__(self):
self.head = None
def __iter__(self):
def max_calls_count(max_count):
def counter(f):
def wrapper(*args, **kwargs):
wrapper.calls_count += 1
if wrapper.calls_count < max_count + 1:
return f(*args, **kwargs)
else:
raise RuntimeError('Only {} calls allowed'.format(max_count))
wrapper.calls_count = 0
return wrapper
#include <cstring>
#include <stddef.h>
#include <stdio.h>
void Swap(char& a, char& b) {
char c = a;
a = b;
b = c;
}
#include <thread>
#include <mutex>
#include <iostream>
class PPWriter {
public:
void WritePingPong();
private:
enum State {
PING = 0,
import multiprocessing
from multiprocessing.dummy import Pool as ThreadPool
def calc_sum(k):
return sum(xrange(k))
def dummy_threads_calc():
pool = ThreadPool(50)
@kirr
kirr / gist:022c26a34ad8aeeddf6dc87e84ff3261
Created February 27, 2018 10:07
Telemetry changes. Add tests "timeout" decotator.
diff --git a/src/third_party/catapult/telemetry/telemetry/decorators.py b/src/third_party/catapult/telemetry/telemetry/decorators.py
index ecc97fb..1bbc5d69 100644
--- a/src/third_party/catapult/telemetry/telemetry/decorators.py
+++ b/src/third_party/catapult/telemetry/telemetry/decorators.py
@@ -220,6 +220,27 @@ def Isolated(*args):
return _Isolated
+def Timeout(timeout_sec):
+ def _Timeout(func):
@kirr
kirr / gist:125af6e3308f684b158b9effcfab9a8c
Created February 27, 2018 10:03
Catapult changes. Add timeout decorator.
diff --git a/src/third_party/catapult/common/py_trace_event/py_trace_event/trace_event_impl/multiprocessing_shim.py b/src/third_party/catapult/common/py_trace_event/py_trace_event/trace_event_impl/multiprocessing_shim.py
index 9796bdf..e82ac09 100644
--- a/src/third_party/catapult/common/py_trace_event/py_trace_event/trace_event_impl/multiprocessing_shim.py
+++ b/src/third_party/catapult/common/py_trace_event/py_trace_event/trace_event_impl/multiprocessing_shim.py
@@ -3,6 +3,7 @@
# found in the LICENSE file.
import multiprocessing
import log
+import os
import time