Skip to content

Instantly share code, notes, and snippets.

@cruepprich
cruepprich / venv.sh
Created December 30, 2021 22:11
Python Virtual Environments
# Create new virtual environment
# cd VirtualEnvironments
# python3 -m venv mycoolapp
# $ . venv mycoolapp
source ~/VirtualEnvironments/$1/bin/activate
@cruepprich
cruepprich / betting.py
Created October 19, 2021 20:48
[Betting Game]
import random
wins=[]
losses=0
nbr_games=5
for gameidx in range(nbr_games):
wallet=maxwallet=100
limit=200
bet=1
# print(f"\n\nNew game {gameidx}")
@cruepprich
cruepprich / yum.md
Created October 15, 2021 16:29
[Configure Yum on OCI Compute Insance] #linux

In the user-managed OCI compartments, the compute instances are behind a proxy. To use the proxy, set the following environment variables:

export http_proxy=www-proxy-ash7.us.oracle.com:80
export https_proxy=www-proxy-ash7.us.oracle.com:80

or

@cruepprich
cruepprich / firewall.md
Created October 15, 2021 16:28
[How to Allow HTTP and HTTPS Services in FirewallD] #linux

https://tecadmin.net/allow-http-service-firewalld/ Written by Rahul, Updated on March 23, 2020

FirewallD is a firewall management solution for most of the Linux distributions. You can directly allow/deny ports using the service name with Firewalld. When used services name to allow/deny, it uses /etc/services file to find corresponding port of the service. This tutorial help you to open port for HTTP (80) and HTTPS (443) services via the firewall-cmd command line.

Allow HTTP/s in Firewalld

@cruepprich
cruepprich / create_pdb.md
Last active October 15, 2021 16:25
[Create PDB in OCI DBaaS] #database

As sysdba in CDB:

CREATE PLUGGABLE DATABASE TESTPDB ADMIN USER test_admin IDENTIFIED BY test_admin
 STORAGE (MAXSIZE 2G)
 DEFAULT TABLESPACE USERS
 DATAFILE '+DATA' SIZE 250M AUTOEXTEND ON;

ALTER PLUGGABLE DATABASE TESTPDB OPEN READ WRITE;
@cruepprich
cruepprich / artifactory.sh
Created October 15, 2021 16:17
[Artifactory CLI Commands] Use cURL to upload/download files to/from Artifiactory #artifactory
#upload
curl -H "X-JFrog-Art-Api:${XGBU_ARTIFACTORY_API_KEY}" \
-T ~/Downloads/sqlcl-21.2.2.223.0914.zip \
"https://artifacthub-iad.oci.oraclecorp.com/artifactory/xgbu-ace-dev/oci_build/sqlcl-21.2.2.223.0914.zip"
#download
curl -H "X-JFrog-Art-Api:${XGBU_ARTIFACTORY_API_KEY}" \
-O "https://artifacthub-iad.oci.oraclecorp.com/artifactory/xgbu-ace-dev/oci_build/sqlcl-21.2.2.223.0914.zip"
@cruepprich
cruepprich / _prerequisites.md
Last active October 15, 2021 15:11
[ORDS Standalone: Configure SSL Certificate Chain] Process for installing an SSL certificate chain in ORDS running in Standalone mode. #ords

Prerequisites:

  • One instance certificate
    • Certificate file in text format
    • Certificate private key file
  • Intermediate certificate in text format
@cruepprich
cruepprich / manage_oci_vault_secrets.sh
Created October 15, 2021 15:04
[OCI Vault: Manage a Secret via CLI] Various snippets to manage OCI Vault secrets #ocicli
export VAULT_OCID=ocid1.vault.oc1.iad.xxx # Edit as needed
export COMPARTMENT_OCID=ocid1.compartment.oc1..xxx # Edit as needed
export KEY_OCID=ocid1.key.oc1.iad.xxx # Edit as needed
export PASSWORD=$(openssl rand -base64 32 | base64) # See http://bit.ly/gen-pwd
export SECRET_NAME="my_secret-demo"
export VAULT_USER_PROFILE="VAULT_USER" # OCI CLI Profile
# See a list of vaults in a compartment
oci kms management vault list \
--profile $VAULT_USER_PROFILE \
@cruepprich
cruepprich / fn_map.py
Last active October 15, 2021 14:55
[Dictionary to Control Function Calling] Use a dictionary instead of if-then
#!/usr/bin/env python3
from sys import argv
"""Example for using a dictionary to map function calls from
argument variables.
Usage:
fn_map.py this foo
fn_map.py that '{"one":"foo","two":"bar"}'
fn_map.py other baz