Skip to content

Instantly share code, notes, and snippets.

View hbasria's full-sized avatar

Basri hbasria

  • base9.tech
  • ///soak.massing.glory
View GitHub Profile
kubectl apply -f https://raw.githubusercontent.com/jetstack/cert-manager/release-0.8/deploy/manifests/00-crds.yaml
kubectl create namespace cert-manager
kubectl label namespace cert-manager certmanager.k8s.io/disable-validation="true"
helm repo add jetstack https://charts.jetstack.io
helm repo update
@hbasria
hbasria / cattle-system-patch.sh
Created April 10, 2020 21:19
Cattle-Cluster-Agent: (Could not resolve host: rancher.<server-name>.com)
kubectl -n cattle-system patch deployments cattle-cluster-agent --patch '{
"spec": {
"template": {
"spec": {
"hostAliases": [
{
"hostnames":
[
"{{ rancher_server_hostname }}"
],
@hbasria
hbasria / .gitignore
Created November 14, 2019 08:29 — forked from chrisdone/.gitignore
Linux + BusyBox + QEMU/VirtualBox/USB boot recipe
output/
@hbasria
hbasria / delete-evicted-pods-all-namespaces.sh
Created July 19, 2019 21:01 — forked from svx/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
@hbasria
hbasria / sqlite_custom_function.py
Created July 18, 2019 14:46
python SQLite custom function
import sqlite3
from netaddr import IPNetwork
def is_private_ip(value):
return IPNetwork(value).is_private()
connection = sqlite3.connect(':memory:')
cur = connection.cursor()
cur.execute("""
@hbasria
hbasria / run_scheduled.py
Last active June 10, 2018 04:50 — forked from numberoverzero/run_scheduled.py
00.async.periodic.rst
import asyncio
import functools
import json
import secrets
import aiohttp
from concurrent.futures import ALL_COMPLETED
@hbasria
hbasria / postgresql-set-id-seq.sql
Created May 10, 2018 07:36 — forked from henriquemenezes/postgresql-set-id-seq.sql
PostgreSQL set Next ID Sequence Value to MAX(id) from Table
-- Get Max ID from table
SELECT MAX(id) FROM table;
-- Get Next ID from table
SELECT nextval('table_id_seq');
-- Set Next ID Value to MAX ID
SELECT setval('table_id_seq', (SELECT MAX(id) FROM table));
@hbasria
hbasria / server.conf
Created April 27, 2018 14:19 — forked from Tristor/server.conf
OpenVPN server.conf
# Basic Connection Config
dev tun
proto udp
port 1194
keepalive 10 120
max-clients 5
# Certs
ca ca.crt
cert server.crt
@hbasria
hbasria / smtptest.py
Created April 24, 2018 06:15
smtp test
#!/usr/bin/python
"""smtptest.py: command-line smtp test mail sender
https://github.com/turbodog/python-smtp-mail-sending-tester
Usage: python smtptest.py [options] fromaddress toaddress serveraddress
Examples:
python smtptest.py bob@example.com mary@example.com mail.example.com
python smtptest.py --debuglevel 1 --usetls -u bob -p xyzzy "Bob <bob@example.com>" mary@example.com mail.example.com
At verbose == False and debuglevel == 0, smtptest will either succeed silently or print an error. Setting verbose or a debuglevel to 1 will generate intermediate output.
See also http://docs.python.org/library/smtplib.html
"""
<?php
/**
* Coin Dashboard by Christian Haschek
* https://blog.haschek.at
*
* Donations always welcome
* BTC: 1ChrisHMgr4DvEVXzAv1vamkviZNLPS7yx
* ETH: 0x1337C2F18e54d72d696005d030B8eF168a4C0d95
*
* Read more at