Skip to content

Instantly share code, notes, and snippets.

import sys
from datetime import datetime
first_ts = None
FMT = "%Y-%m-%d %H:%M:%S"
class Result(object):
def __init__(self):
self.start_ts = None
self.total = 0
@aravindavk
aravindavk / failurelogs.d
Last active June 7, 2019 13:03
`./failurelogs.d regression-1.log > failed_logs_1.log` (D language (https://dlang.org/), `dmd` is required to run this script)
#!/usr/bin/rdmd
import std.stdio;
import std.string;
import std.conv;
void main(string[] args)
{
string[] records;
bool inRecord;
MASTER=master.example.com
N1=kube-node1.example.com
N2=kube-node2.example.com
N3=kube-node3.example.com
STORAGE_POOL_NAME=sp1
OPERATOR_YAML=operator.yaml
PVC_NAME=pv1
PVC_FILE_NAME=pv1.yaml
APP_POD_NAME=pod1
APP_POD_FILE=pod1.yaml
@aravindavk
aravindavk / missing_errnos.cr
Created June 30, 2020 17:23
Missing Errnos - Crystal lang
# Run this using
# touch sample.txt
# crystal run missing_errnos.cr -- sample.txt
# Above command fails to compile if we uncomment the line 39
lib LibXAttr
{% if flag?(:linux) %}
fun getxattr(path : LibC::Char*, name : LibC::Char*, value : LibC::Char*, size : LibC::SizeT) : LibC::Int
{% end %}
{% if flag?(:darwin) %}
fun getxattr(path : LibC::Char*, name : LibC::Char*, value : LibC::Char*, size : LibC::SizeT, position : LibC::UInt32T, options : LibC::Int) : LibC::Int
#!/usr/bin/env dub
/+ dub.sdl:
dependency "serverino" version="~>0.7.9"
+/
import std.typecons;
import std.string;
import std.conv;
import serverino;