Skip to content

Instantly share code, notes, and snippets.

View kiorky's full-sized avatar

kiorky kiorky

  • Brasov, Romania
View GitHub Profile
@kiorky
kiorky / dockermachinewrapper.sh
Last active October 11, 2022 18:16
dockermachinewrapper
#!/bin/bash
set -ex
wait_ready() { s="${s:-0.5}";t="${t:-800}";start=$(date +%s);until ("$@";);do
d=$(date +%s);dt=$((${d}-${start}));if [ ${dt} -gt ${t} ];then log " no more retries: $@";return 1;fi
if [ $(( ${dt} % ${CI_OPEN_MSG_DELAY:-240} )) -eq 0 ];then log " CI keeps open";fi
(cat /dev/zero|read -t ${s}||exit 0);done; }
t=300 wait_ready docker version
curl -fsSL https://get.docker.com > docker.sh
chmod +x docker.sh
@kiorky
kiorky / docker-compose.yml
Last active September 13, 2018 10:41
docker systemd
---
version: '3.6'
x-image: &image_template
image: "corpusops/debian"
environment:
- a=1
command: >
sh -c 'if [ "x$DOCKER_SKIP_START" != x ];
then while true;do echo sleeping;sleep 65535;done
else exec /app_entry_point;
@kiorky
kiorky / ciphers.sh
Last active February 14, 2018 12:38
for cipher in $(ssh -Q cipher) ; do
for i in 1 2 3 ; do
echo
echo "Cipher: $cipher (try $i)"
if dd if=/dev/zero bs=1M count=128 2>/tmp/dd.txt \
| pv \
| time -p ssh -c "$cipher" -F .vagrant/cops-sshconfig-corpusops* vagrant 'cat > /dev/null';then
grep -v records /tmp/dd.txt
break
fi
@kiorky
kiorky / .gitignore
Last active March 21, 2017 18:02
debug docker-squash
*.tar
docker/
dtest/
s/
import subprocess
class ProcessError(IOError):
pass
def cmdrun(cli,
debug=False,
shell=True,
#include <netdb.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#define CANARY "in_the_coal_mine"
struct {
char buffer[1024];
@kiorky
kiorky / saltperf.py
Last active August 29, 2015 13:56
saltperf.py
#!/usr/bin/env python
'''
calculate from 1 minion to NB_MINIONS the time
to parse the output states dictionnary results
python -m cProfile -o outfile.stat ./saltperf.py;pyprof2calltree -i outfile.stat -o outfile.pstat
'''
from __future__ import (absolute_import, division,
@kiorky
kiorky / uniq.py
Last active November 16, 2019 03:20
own version of list unification
from collections import OrderedDict
import itertools
from random import shuffle, randint
import re
from sets import Set
def f1(seq): # Raymond Hettinger
# not order preserving
set = {}
map(set.__setitem__, seq, [])
@kiorky
kiorky / do.sh
Last active December 19, 2015 21:19
install stack ubuntu gis
#!/usr/bin/env bash
cd ecws || exit -1
out=../out
warp() {
echo gdalwarp $WRAP_OPTS -s_srs EPSG:2154 -of "$1" "$2" "$3"
gdalwarp $WRAP_OPTS -s_srs EPSG:2154 -of "$1" "$2" "$3"
if [[ $? != 0 ]];then exit -1;fi
}
translate() {
echo gdal_translate $TRANSLATE_OPTS -of "$1" "$2" "$3"
@kiorky
kiorky / cisco.py
Last active December 16, 2015 22:39
for spynner #35
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__docformat__ = 'restructuredtext en'
import spynner
import os
import sys
class CSCCAuthenticationError(Exception):pass
timeout=60