Skip to content

Instantly share code, notes, and snippets.

@okld
okld / components_callbacks.py
Last active March 8, 2024 22:00
Patch to use callbacks with Streamlit custom components.
"""Patch to use callbacks with Streamlit custom components.
Usage
-----
>>> import streamlit.components.v1 as components
>>> from components_callbacks import register_callback
>>>
>>> print("Script begins...")
>>>
@renuka-fernando
renuka-fernando / force-delete-namespace.sh
Last active January 15, 2023 13:16
Kubernetes - Force delete a Namespace with Invalid Finalizers
# namespace to be deleted in k8s
NAMESPACE=foo
# Terminal 1
kubectl proxy
# Terminal 2
kubectl get ns $NAMESPACE -o json | \
jq '.spec.finalizers=[]' | \
curl -X PUT "http://localhost:8001/api/v1/namespaces/${NAMESPACE}/finalize" -H "Content-Type: application/json" --data @-
@p3jitnath
p3jitnath / install-docker.sh
Last active June 22, 2024 11:56
Docker and Nvidia Docker installation in Ubuntu 20.04 LTS
# WARNING : This gist in the current form is a collection of command examples. Please exercise caution where mentioned.
# Docker
sudo apt-get update
sudo apt-get remove docker docker-engine docker.io
sudo apt install docker.io
sudo systemctl start docker
sudo systemctl enable docker
docker --version
@jetersen
jetersen / add-cert.py
Created March 8, 2020 09:00
Python: add custom root ca to certifi store
import requests
import certifi
import sys
try:
requests.get('https://any-website-protected-by-your-custom-root-ca')
print('Certificate already added to the certifi store')
sys.exit(0)
except requests.exceptions.SSLError as err:
print('SSL Error. Adding custom certs to Certifi store...')
@vicsimental
vicsimental / PHP_OCI.md
Last active August 30, 2023 12:12
How to install OCI8 on Debian 10 Buster / Ubuntu 18.04 LTS / Ubuntu 16.04 and PHP 7.3
import json
import subprocess
import sys
import os
import zipfile
def upload_editable_requirement_from_current_venv(sc):
for requirement_dir in get_editable_requirements():
add_lib_to_spark_context(requirement_dir, sc)
import json
import subprocess
import sys
from pex.fetcher import PyPIFetcher
from pex.pex_builder import PEXBuilder
from pex.resolvable import Resolvable
from pex.resolver import resolve_multi, Unsatisfiable, Untranslateable
from pex.resolver_options import ResolverOptionsBuilder
@nebulak
nebulak / ca-setup.md
Last active February 2, 2024 20:44
python mutual tls for client certificate validation
# sources:
# https://kb.op5.com/pages/viewpage.action?pageId=19073746#sthash.9gTMRKM1.dpbs
# https://stackoverflow.com/a/26093147
# https://jamielinux.com/docs/openssl-certificate-authority/sign-server-and-client-certificates.html
# additional ressource: https://gist.github.com/Soarez/9688998
# TODO: renew certificates and ca, add capability for authentication to client cert
# TODO ressources: https://gist.github.com/richieforeman/3166387

HKP_PATH=""

@Torenable
Torenable / knime Batch execute
Last active March 11, 2021 19:23 — forked from semeltheone/knime Batch execute
Knime Execute Workflows from the Commandline
# Windows:
knime.exe -consoleLog -noexit -nosplash -application org.knime.product.KNIME_BATCH_APPLICATION -workflowFile="PathToYourWorkflow.zip" -destFile="OutputPathToYourWorkflow.zip"
# Mac
/Applications/KNIME\ 3.5.3.app/Contents/MacOS/Knime -nosplash -application org.knime.product.KNIME_BATCH_APPLICATION -workflowFile="PathToYourWorkflow.zip" -destFile="OutputPathToYourWorkflow.zip"
# Linux
knime -nosplash -application org.knime.product.KNIME_BATCH_APPLICATION -workflowFile="PathToYourWorkflow.zip" -destFile="OutputPathToYourWorkflow.zip"
@bennadel
bennadel / request_wildcard_certificate.sh
Created March 14, 2018 12:22
Obtaining A Wildcard SSL Certificate From LetsEncrypt Using The DNS Challenge
#!/bin/bash
#
# /etc/letsencrypt
# WHAT: This is the default configuration directory. This is where certbot will store all
# generated keys and issues certificates.
#
# /var/lib/letsencrypt
# WHAT: This is default working directory.
#