Skip to content

Instantly share code, notes, and snippets.

View bdnf's full-sized avatar
Somewhere in the Clouds

Oleh Bodunov bdnf

Somewhere in the Clouds
  • TU Dresden
View GitHub Profile
@bdnf
bdnf / setting_java_in_docker
Last active October 9, 2019 13:12
Set JAVA_HOME in docker container
RUN apt-get update && \
apt-get install -y openjdk-8-jdk && \
apt-get install -y ant && \
apt-get clean && \
rm -rf /var/lib/apt/lists/ && \
rm -rf /var/cache/oracle-jdk8-installer;
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64/
RUN export JAVA_HOME
@bdnf
bdnf / multiple_apps.py
Last active August 31, 2020 10:26
Logging across multiple modules
#app.py
import logging
from logging.handlers import TimedRotatingFileHandler
from flask import Flask
import new_module1
import new_module2
def create_app():
app = Flask(__name__)
@bdnf
bdnf / redis_conn.py
Last active August 12, 2019 21:07
Creating Redis client and queue and enqueue items
from rq import Queue as RedisQueue
from redis import Redis
from rq.job import Job
from urllib.request import urlopen, Request
from xml.etree import ElementTree
def get_news():
headers = {'User-Agent': 'Mozilla/5.0'}
url = 'https://news.yahoo.com/rss/all'
@bdnf
bdnf / python_inheritance.py
Created August 9, 2019 17:52
Simple example of multiple inheritance syntax in python
class First(object):
def __init__(self):
super(First, self).__init__()
print("first")
class Second(First):
def __init__(self):
super(Second, self).__init__()
print("second")
@bdnf
bdnf / start-kafka-cli.sh
Last active July 6, 2019 12:40
Setting up Kafka on Linux
# install Java
apt-get install openjdk-8-jdk -y
# download and extract Kafka
mkdir ~/Downloads
curl "https://www.apache.org/dist/kafka/2.1.1/kafka_2.11-2.1.1.tgz" -o ~/Downloads/kafka.tgz
mkdir ~/kafka && cd ~/kafka
tar -xvzf ~/Downloads/kafka.tgz --strip 1
# test installation with: