Skip to content

Instantly share code, notes, and snippets.

View elacheche's full-sized avatar

El Acheche ANIS elacheche

View GitHub Profile
@prudhvigodithi
prudhvigodithi / .txt
Last active March 10, 2022 08:17
Kubectl cheat sheet.
kubectl run nginx image=nginx  --port=80  --record
kubectl set image deployment nginx nginx=nginx:1.2
kubectl rollout history deployment nginx
kubectl rollout status deployment nginx
kubectl rollout undo deployment nginx  --to-revision=2
kubectl autoscale deployment nginx  --cpu-percent=50  -- min=1  -- max 2
kubectl run nginx3  --image=nginx  --requests=cpu=200m  --limits=cpu=300m  --requests=memory=1Gi  --limits=memory=2Gi
kubectl run hello  --schedule=”*/1 * * * *”  --restart=OnFailure  -- image=busybox  -- /bin/sh -c “date; echo Hello from the kubernetes cluster”
kubectl port-forward redis-master-765d459796–258hz 6379:6379
kubectl get pods redis-master-765d459796–258hz -o yaml
@rushilgupta
rushilgupta / GoConcurrency.md
Last active May 14, 2024 06:30
Concurrency in golang and a mini Load-balancer

INTRO

Concurrency is a domain I have wanted to explore for a long time because the locks and the race conditions have always intimidated me. I recall somebody suggesting concurrency patterns in golang because they said "you share the data and not the variables".

Amused by that, I searched for "concurrency in golang" and bumped into this awesome slide by Rob Pike: https://talks.golang.org/2012/waza.slide#1 which does a great job of explaining channels, concurrency patterns and a mini-architecture of load-balancer (also explains the above one-liner).

Let's dig in:

Goroutines

@Kovrinic
Kovrinic / .gitconfig
Last active April 11, 2024 11:50
git global url insteadOf setup
# one or the other, NOT both
[url "https://github"]
insteadOf = git://github
# or
[url "git@github.com:"]
insteadOf = git://github
#!/bin/bash
modprobe -r ec_sys
modprobe ec_sys write_support=1
on="\x8a"
off="\x0a"
led(){
echo -n -e $1 | dd of="/sys/kernel/debug/ec/ec0/io" bs=1 seek=12 count=1 conv=notrunc 2> /dev/null
@leonardofed
leonardofed / README.md
Last active May 10, 2024 10:42
A curated list of AWS resources to prepare for the AWS Certifications


A curated list of AWS resources to prepare for the AWS Certifications

A curated list of awesome AWS resources you need to prepare for the all 5 AWS Certifications. This gist will include: open source repos, blogs & blogposts, ebooks, PDF, whitepapers, video courses, free lecture, slides, sample test and many other resources.


anonymous
anonymous / IRC client in pure bash 4
Created March 28, 2016 16:57
IRC client written in pure bash using only bash builtin commands and no other binaries.
#!/bin/bash
#no PATH, no way to accidently run any programs
PATH=''
#useful variables
term_height=0
term_width=0
term_scroll_height=0
status_line_row=0
@kwilczynski
kwilczynski / disable-ipv6.sh
Last active April 11, 2024 11:09
Amazon Linux OS tweaks
#!/bin/bash
set -u
set -e
set -o pipefail
export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
cat <<'EOF' > /etc/modprobe.d/blacklist-ipv6.conf
@jm-welch
jm-welch / nagios_template.py
Created February 14, 2014 21:20
A simple template for writing Nagios plugin in Python
#! /usr/bin/env python
###############################################################################
# Nagios plugin template
#
# Notes
# - The RHEL boxes I work on are currently limited to Python 2.6.6, hence the
# use of (deprecated) optparse. If I can ever get them all updated to
# Python 2.7 (or better yet, 3.3), I'll switch to argparse
# - This template runs in 2.6-3.3. Any changes made will need to be appropriate
@sloria
sloria / bobp-python.md
Last active May 12, 2024 06:54
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens
@nealrs
nealrs / check.py
Last active December 15, 2016 02:58
supply a first, last, and domain name -- and this script will run through common email patterns to find valid email addresses. worried about domains with catchalls & missing mx records? yeah we got that covered. $ python check.py eric cartman southpark.com
#!/usr/bin/env python
# encoding: utf-8
# install dependencies: sudo pip install validate_email pyDNS
# run it: python check.py robin hood gmail.com
# FYI, forwarding addresses (not catchalls) will report 'probably not valid'. that's all i've got right now.
import sys
from validate_email import validate_email