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:20.04 | |
RUN echo 1 | |
RUN echo "#!/bin/bash" > test.sh && \ | |
echo "echo x" >> test.sh && \ | |
chmod +x test.sh && \ | |
./test.sh |
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 for_all_own_methods(decorator: Callable): | |
""" | |
class decorator | |
apply decorator function to all class methods, excluding inherited ones | |
Args: | |
decorator ([Callable]): decorator function to apply to all own methods | |
""" | |
def decorate(cls): | |
import inspect |
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
""" | |
workaround for dialog interruption for python-telegram-bot | |
see the problem of parallel dialogs: | |
https://stackoverflow.com/questions/64146229/python-telegram-bot-disallow-nested-conversations | |
https://github.com/python-telegram-bot/python-telegram-bot/issues/1640 | |
""" | |
from telegram import ReplyKeyboardMarkup | |
from telegram.ext import ( | |
Updater, |
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
#!/bin/bash | |
# dump mongodb from running docker container to specified archive file | |
# exit on first error | |
set -e | |
ARCHIVE_FILE="${2:-mongo_all.db.archive}" | |
DIR_NAME="$(dirname ${ARCHIVE_FILE})" |
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
#!/bin/sh | |
# wait_for_tcp.sh | |
# wait for tcp port to become available | |
# usage | |
# $ ./wait_for_tcp localhost:80 | |
host="$1" | |
until echo -e '\xdclose\x0d' | curl -v telnet://$host/ ; do |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>flex with scrolls</title> | |
<style> | |
html, body { | |
margin: 0; | |
height: 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
#include <QtCore/QCoreApplication> | |
#include <qdatastream.h> | |
#include <qvector3d.h> | |
#include <qdebug.h> | |
#include <qtcpserver.h> | |
#include <qtcpsocket.h> | |
int main(int argc, char* argv[]) | |
{ |
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 bash | |
# creates bootable disk image as file (e.g. linux.img) | |
# places kernel image and initrd image on this disk | |
# and uses grub install to make it bootable | |
# then you can test it with smthng like 'qemu-system-x86_64 linux.img' | |
echo | |
set -e # terminate script on error |
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 | |
""" | |
does the same as linux 'logger' command (on a basic level) | |
writes msg to rsyslog from current user | |
linux 'logg |
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 | |
from telnetlib import Telnet | |
import telnetlib | |
import re | |
# openvpn managment address and port | |
HOST = "localhost" | |
PORT = 9969 |
NewerOlder