Skip to content

Instantly share code, notes, and snippets.

View aolwas's full-sized avatar

Maxime Cottret aolwas

View GitHub Profile
@aolwas
aolwas / project-env-setup.md
Last active December 9, 2024 16:51
project-env-setup

Isolated project environment setup using direnv, pixi or mise

Requirements

Pixi

Enable pixi with direnv

@aolwas
aolwas / homeassistant-remote-access-using-cloudflare-zero-trust.md
Created October 20, 2023 12:10
homeassistant remote access using cloudflare zero-trust

Cloudflare tunnel

  • Create a tunnel [ref] and install client on homeassistant machine (use cloudflare addon if using HAOS)
  • Create two public hostnames for this tunnel targeting http:localhost:8123
    • my-app for browser access
    • my-app-android for android companion app access
  • Update homeassistant to allow proxied connections:

authorize cloudflare cidr

@aolwas
aolwas / setup-pyspark-env.sh
Last active April 15, 2023 15:07
Pyspark env setup
#!/bin/bash
# This snippet install pyspark and necessary jar dependendies inside a active python environment.
#
# Using conda:
# [Optional] install mambaforge (https://github.com/conda-forge/miniforge)"; exit 1;}
# [Optional] mamba create -n MY_ENV python=3.10 pyspark=3.3.2
# conda activate MY_ENV
#
# Using venv
@aolwas
aolwas / README.md
Last active October 28, 2022 07:37 — forked from zoilomora/README.md
How to disable systemd-resolved in Ubuntu

How to disable systemd-resolved in Ubuntu

Stages

  • Disable and stop the systemd-resolved service:

      sudo systemctl disable systemd-resolved.service
      sudo systemctl stop systemd-resolved
    
  • Then put the following line in the [main] section of your /etc/NetworkManager/NetworkManager.conf:

@aolwas
aolwas / slack_webhook_post.py
Created November 6, 2019 08:55 — forked from devStepsize/slack_webhook_post.py
POST a JSON payload to a Slack Incoming Webhook using Python requests
'''
This is an example of how to send data to Slack webhooks in Python with the
requests module.
Detailed documentation of Slack Incoming Webhooks:
https://api.slack.com/incoming-webhooks
'''
import json
import requests
@aolwas
aolwas / version.py
Last active October 28, 2019 15:18 — forked from mina86/version.py
Extract a setuptools version from the git repository's tags.
# -*- coding: utf-8 -*-
"""Calculates the current version number.
Uses output of “git describe --long --tags --always --dirty='-dev-$(date +%s)'”
interpreted as <version>-<commits>-<sha>-<dirty>
if commits != 0 and not dirty, return version else return full output.
If "git describe" fails (when install via package, copied src, etc), version is
@aolwas
aolwas / change-uid-gid.py
Created November 6, 2017 10:45
Recursively change uid/gid according a map of old to new uid/gid
#!/usr/bin/env python
from __future__ import print_function
import os
import sys
UID_MAP = {
# OLD_UID: NEW_UID
}
@aolwas
aolwas / traefik-rbac.yml
Created April 8, 2017 08:12
Kubernetes RBAC manifest for Traefik ingress controller
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: traefik-ingress-controller
rules:
- apiGroups:
- ""
resources:
- pods
#!/bin/bash -e
ln -s /usr/lib/x86_64-linux-gnu/amdgpu-pro .
ln -s /etc/OpenCL .
tar -czvf libs.tar.gz amdgpu-pro/*
tar -czvf conf.tar.gz OpenCL/*
cat > .dockerignore << EOF
OpenCL
@aolwas
aolwas / pedantically_commented_playbook.yml
Created November 30, 2015 11:01 — forked from marktheunissen/pedantically_commented_playbook.yml
Insanely complete Ansible playbook, showing off all the options
---
# ^^^ YAML documents must begin with the document separator "---"
#
#### Example docblock, I like to put a descriptive comment at the top of my
#### playbooks.
#
# Overview: Playbook to bootstrap a new host for configuration management.
# Applies to: production
# Description:
# Ensures that a host is configured for management with Ansible.