Skip to content

Instantly share code, notes, and snippets.

View eon01's full-sized avatar
🎯
Focusing

Aymen EL Amri eon01

🎯
Focusing
View GitHub Profile
@fosterseth
fosterseth / awx_how_a_job_runs.md
Last active June 28, 2024 10:28
How a job runs
@LegolasVzla
LegolasVzla / request_validator.txt
Last active November 20, 2020 15:29
Django, Django Rest Framework, Postman validator of type of request in a Class Based View (API)
'''
When you're developing an Endpoint with Django Rest Framework, in some situations you'll want to re-use it for generating example data, make tests (e.g. in DRF API View, Postman, Swagger IO...) and also to use it in your web app. For that reason, you'll receive differents types of request. On way to handle with this problem, is to create a decorator method to validate the type of request and then, in your CFA or CVB call the decorator.
_instance= MyNameViewSet()
_instance.endpoint_name(request,param1=1,param2=1)
'''
# Request validation is like that:
from functools import wraps
@svx
svx / delete-evicted-pods-all-namespaces.sh
Created August 15, 2018 12:45 — forked from psxvoid/delete-evicted-pods-all-namespaces.sh
Delete evicted pods from all namespaces (also ImagePullBackOff and ErrImagePull)
#!/bin/sh
# based on https://gist.github.com/ipedrazas/9c622404fb41f2343a0db85b3821275d
# delete all evicted pods from all namespaces
kubectl get pods --all-namespaces | grep Evicted | awk '{print $2 " --namespace=" $1}' | xargs kubectl delete pod
# delete all containers in ImagePullBackOff state from all namespaces
kubectl get pods --all-namespaces | grep 'ImagePullBackOff' | awk '{print $2 " --namespace=" $1}' | xargs kubectl delete pod
# delete all containers in ImagePullBackOff or ErrImagePull or Evicted state from all namespaces
from apiclient.discovery import build
from apiclient.errors import HttpError
from oauth2client.tools import argparser
import pandas as pd
import pprint
import matplotlib.pyplot as pd
DEVELOPER_KEY = "YOUR_DEVELOPER_KEY_HERE"
YOUTUBE_API_SERVICE_NAME = "youtube"
YOUTUBE_API_VERSION = "v3"
@enisozgen
enisozgen / ansible-nested-variable.yml
Last active November 4, 2023 10:21
Ansible example which shows how to reach nested variable with dynamic elements
# Example which shows how to reach nested ansible variable which is partially different.
# Run that plabook with ansible-playbook -e "env=test" ansible-nested-variable.yml
---
#
- hosts: localhost
connection : ssh
gather_facts: no
vars:
cidr_blocks:
vpc_production_cidr_block: "10.10.0.0/28"
@whiteinge
whiteinge / complex_salt_orchestrate.sls
Last active March 20, 2024 15:48
An example of a complex, multi-host Salt Orchestrate state that performs status checks as it goes
# /srv/salt/upgrade_the_app.sls
# Example of a complex, multi-host Orchestration state that performs status checks as it goes.
# Note, this is untested and is meant to serve as an example.
# Run via: salt-run state.orch upgrade_the_app pillar='{nodes: [nodeA, nodeB], version: 123}'
{% set nodes = salt.pillar.get('nodes', []) %}
{% set all_grains = salt.saltutil.runner('cache.grains',
tgt=','.join(nodes), tgt_type='list') %}
{# Default version if not given at the CLI. #}
@alexellis
alexellis / README.md
Last active March 25, 2022 19:28
Live Stream to YouTube from your RPi with Docker

Live Stream to YouTube from your RPi with Docker

Normally ffmpeg needed to stream to YouTube takes 8-9 hours to build on a PiZero. You can download my image here and run it with your secret key:

docker run --privileged -ti alexellis2/streaming:17-5-2017 <secret>

Bill of materials:

@valentin2105
valentin2105 / ha-wordpress.service
Last active March 19, 2021 09:09
High-Available Wordpress PoC on Docker Swarm 1.12.x with MariaDB Galera cluster.
#! /bin/bash
wordpressPath=/srv/wp01
wordpressName=wordpress01
wordpressPwd=pAssw0rd
wordpressUrl=wordpress01.example.com
##################################
mkdir -p "$wordpressPath"/db
@manifestinteractive
manifestinteractive / sniff.txt
Last active November 23, 2023 02:16
A friendly formatter for curl requests to help with debugging.
\n
============= HOST: ==========\n
\n
local_ip: %{local_ip}\n
local_port: %{local_port}\n
remote_ip: %{remote_ip}\n
remote_port: %{remote_port}\n
\n
======= CONNECTION: ==========\n
\n
@iMilnb
iMilnb / boto3_hands_on.md
Last active October 19, 2022 09:15
Programmatically manipulate AWS resources with boto3 - a quick hands on

boto3 quick hands-on

This documentation aims at being a quick-straight-to-the-point-hands-on AWS resources manipulation with [boto3][0].

First of all, you'll need to install [boto3][0]. Installing it along with [awscli][1] is probably a good idea as

  • [awscli][1] is boto-based
  • [awscli][1] usage is really close to boto's