Skip to content

Instantly share code, notes, and snippets.

@pando85
pando85 / merge_dict.py
Last active Feb 11, 2020
Python deep merge dict
View merge_dict.py
import pytest
def merge_dict(a, b):
for key in b:
if key in a:
if isinstance(a[key], dict) and isinstance(b[key], dict):
merge_dict(a[key], b[key])
elif a[key] == b[key]:
pass
@pando85
pando85 / user_data_jenkins_slave.sh
Created May 30, 2019
User Data for jenkins slave in Openstack
View user_data_jenkins_slave.sh
#!/bin/bash
curl ${SLAVE_JAR_URL} -o /var/lib/jenkins/agent.jar
#/etc/systemd/system/sebasshtian.service
cat << EOF > /etc/systemd/system/jenkins-slave.service
[Unit]
Description=Jenkins-slave
After=network.target
@pando85
pando85 / docker_arm.md
Last active Jan 16, 2020
Docker arm images
View docker_arm.md

Docker in ARM

Buildx

docker buildx build --platform linux/amd64,linux/arm64 \
    -t registry.k8s.grigri/pypiserver:v1.3.2 -f Dockerfile  --output type=registry .
@pando85
pando85 / debug.md
Created Jan 21, 2019
Debug process
View debug.md

Debug processes

Files acceded by process

strace -f -t -e trace=file <command>
@pando85
pando85 / notify
Created Dec 22, 2018
notify to telegram with simple curl
View notify
#!/bin/sh
TOKEN=
CHAT_ID=
curl -s -X POST https://api.telegram.org/bot${TOKEN}/sendMessage -d chat_id=$CHAT_ID -d text="$1"
View mariadb.md

MariaDB Galera

MariaDB in multi-master configuration. Allow scalability.

It works, inclusive, over the WAN network.

Requirements

  • Minimum 3 masters
View zfz.md

fzf

install

config

# Setup fzf
# ---------
@pando85
pando85 / compose.py
Created Aug 17, 2017
compose functions in python like haskell
View compose.py
class Composable(object):
''' A function decorator that allows you to use Haskell style dot notation for function composition '''
fns = {}
def __init__(self, fn):
self.fn = fn
Composable.fns[fn.__name__] = fn
def __call__(self, *args, **kwargs):
''' simply calls the function '''
You can’t perform that action at this time.