Skip to content

Instantly share code, notes, and snippets.

@AoJ
AoJ / anaconda_build.sh
Created August 4, 2020 07:24
Anaconda simple builder
#!/usr/bin/env bash
set -uxeo pipefail
# https://docs.conda.io/en/latest/miniconda.html#linux-installers
# warning, creates ~/.conda dir, you can delete it manually
###############################################
# setup variables
###############################################
@AoJ
AoJ / HAclustering.md
Created June 17, 2020 09:30
High Availability (HA) and Clustering: 2-Node (Master / Slave) PostgreSQL Cluster
@AoJ
AoJ / README.md
Created May 14, 2020 09:09 — forked from nrocco/README.md
Alpine Playground with libvirt

First download alpine-make-vm-image from https://github.com/alpinelinux/alpine-make-vm-image

wget https://raw.githubusercontent.com/alpinelinux/alpine-make-vm-image/v0.4.0/alpine-make-vm-image \
    && echo '5fb3270e0d665e51b908e1755b40e9c9156917c0  alpine-make-vm-image' | sha1sum -c \
    || exit 1
mv alpine-make-vm-image /usr/local/bin/
chmod +x /usr/local/bin/alpine-make-vm-image

Create a new alpine qcow2 image

@AoJ
AoJ / happykaktus.py
Created February 24, 2020 15:27 — forked from oskar456/happykaktus.py
Scrap mujkaktus.cz and send news to a Telegram channel
#!/usr/bin/env python3
import lxml.html
import urllib.request
from pathlib import Path
import requests
telegram_bot_token = "FIXME"
telegram_group_name = "@kvetinac"
@AoJ
AoJ / auth.py
Created December 11, 2019 13:18 — forked from ibeex/auth.py
Python LDAP (ActiveDirectory) authentication
import ldap
def check_credentials(username, password):
"""Verifies credentials for username and password.
Returns None on success or a string describing the error on failure
# Adapt to your needs
"""
LDAP_SERVER = 'ldap://xxx'
# fully qualified AD user name
LDAP_USERNAME = '%[email protected]' % username
@AoJ
AoJ / vmware-template.centos7.sh
Created October 10, 2019 09:50 — forked from efeldhusen/vmware-template.centos7.sh
Bash script for Centos 7.x VMware Template Images
#!/bin/bash
#Paths are for Centos 7.x
#stop logging services
/sbin/service rsyslog stop
/sbin/service auditd stop
#remove old kernels
/usr/bin/package-cleanup --oldkernels --count=1
@AoJ
AoJ / parse.awk
Created May 13, 2018 11:04
awk csv parser :)
#!/usr/bin/awk -f
# Sample 1: 3141,"Smith, John",$52000
# col[0] = 3141
# col[1] = Smith, John
# col[2] = $52000
# Sample 2: 3141,"John ""The Rocket"" Smith",$52000
# col[0] = 3141
# col[1] = John "The Rocket" Smith
# col[2] = $52000
head = $0 {
@AoJ
AoJ / _summary.md
Created February 16, 2018 11:53 — forked from squito/_summary.md
spark sql timestamp semantics, and how they changed from 2.0.0 to 2.0.1 (see query_output_2_0_0.txt vs query_output_2_0_1.txt) changed by SPARK-16216

Spark "Timestamp" Behavior

Reading data in different timezones

Note that the ansi sql standard defines "timestamp" as equivalent to "timestamp without time zone". However Spark's behavior depends on both the version of spark and the file format

format \ spark version <= 2.0.0 >= 2.0.1
val grpcJavaVersion = "1.3.0"
val downloadJGrpc = {
val grpcArtifactId = "protoc-gen-grpc-java"
val jgrpcExeFileName = {
val os = if (scala.util.Properties.isMac) "osx-x86_64"
else if (scala.util.Properties.isWin) "windows-x86_64"
else "linux-x86_64"
# env
export KAFKA_HOST="my.kafka.hostname"
export KAFKA_OPTS="-Djava.security.auth.login.config=/etc/kafka/kafka_server_jaas.conf"
# create topics
kafka-topics --create --topic securing-kafka --replication-factor 1 --partitions 3 --zookeeper $KAFKA_HOST:2181
# producer acl
kafka-acls --authorizer-properties zookeeper.connect=$KAFKA_HOST:2181 --add --allow-principal User:kafkaclient --producer --topic securing-kafka