Skip to content

Instantly share code, notes, and snippets.

@DevOps0926
DevOps0926 / upper_lower_count.py
Created February 15, 2025 07:45 — forked from solen003/upper_lower_count.py
Write a program that accepts a sentence and calculate the number of upper case letters and lower case letters. Suppose the following input is supplied to the program: Hello world! Then, the output should be: UPPER CASE 1 LOWER CASE 9
phrase = input("Type in: ")
phrase = list(phrase)
u, l = 0, 0
for i in phrase:
if i.isupper():
u = u + 1
if i.islower():
l = l + 1
else:
@DevOps0926
DevOps0926 / by7_notby5.py
Created February 15, 2025 06:54 — forked from solen003/by7_notby5.py
Write a program which will find all such numbers which are divisible by 7 but are not a multiple of 5, between 2000 and 3200 (both included). The numbers obtained should be printed in a comma-separated sequence on a single line.
#Write a program which will find all such numbers which are divisible
# by 7 but are not a multiple of 5,
#between 2000 and 3200 (both included).
#The numbers obtained should be printed in a comma-separated sequence
#on a single line.
by7_notby5 = [i for i in range(2000, 3201) if (i % 7 == 0) and (i % 5 != 0)]
print(by7_notby5)
@DevOps0926
DevOps0926 / robot.py
Created February 15, 2025 06:18 — forked from solen003/robot.py
A robot moves in a plane starting from the original point (0,0). The robot can move toward UP, DOWN, LEFT and RIGHT with a given steps. The trace of robot movement is shown as the following: UP 5 DOWN 3 LEFT 3 RIGHT 2 ¡­ The numbers after the direction are steps. Please write a program to compute the distance from current position after a sequen…
import math
x, y = 0, 0
while True:
step = input("Type in UP/DOWN/LEFT/RIGHT #step number: ")
if step == "":
break
@DevOps0926
DevOps0926 / robot.py
Created February 15, 2025 06:18 — forked from solen003/robot.py
A robot moves in a plane starting from the original point (0,0). The robot can move toward UP, DOWN, LEFT and RIGHT with a given steps. The trace of robot movement is shown as the following: UP 5 DOWN 3 LEFT 3 RIGHT 2 ¡­ The numbers after the direction are steps. Please write a program to compute the distance from current position after a sequen…
import math
x, y = 0, 0
while True:
step = input("Type in UP/DOWN/LEFT/RIGHT #step number: ")
if step == "":
break
Pre-Reqs
---
1) CDK
2) NPM
3) A Github repository
1. Run this command
export CDK_NEW_BOOTSTRAP=1
npx cdk bootstrap aws://<YOUR_ACCONT_ID>/<YOUR_REGION> --cloudformation-execution-policies arn:aws:iam::aws:policy/AdministratorAccess aws://<YOUR_ACCONT_ID>/<YOUR_REGION>
Pre-Reqs
---
1) CDK
2) NPM
3) A Github repository
1. Run this command
export CDK_NEW_BOOTSTRAP=1
npx cdk bootstrap aws://<YOUR_ACCONT_ID>/<YOUR_REGION> --cloudformation-execution-policies arn:aws:iam::aws:policy/AdministratorAccess aws://<YOUR_ACCONT_ID>/<YOUR_REGION>
@DevOps0926
DevOps0926 / openshift-install.sh
Created December 5, 2024 03:36 — forked from fredhsu/openshift-install.sh
Install OpenShift container platform package
# Assumes that subscription manager has been registered and repos added
sudo yum -y install wget git net-tools bind-utils iptables-services bridge-utils bash-completion kexec-tools sos psacct
sudo yum -y update
sudo yum -y install atomic-openshift-utils
sudo yum -y install docker
@DevOps0926
DevOps0926 / install-kubeadm-deb-stretch.sh
Created December 5, 2024 03:35 — forked from fredhsu/install-kubeadm-deb-stretch.sh
Install kube services on debian stretch
apt-get update && apt-get install -y apt-transport-https curl
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
cat <<EOF >/etc/apt/sources.list.d/kubernetes.list
deb https://apt.kubernetes.io/ kubernetes-stretch main
EOF
apt-get update
apt-get install -y kubelet kubeadm kubectl
apt-mark hold kubelet kubeadm kubectl
@DevOps0926
DevOps0926 / install-docker-deb-stretch.sh
Created December 5, 2024 03:34 — forked from rkamisetti792/install-docker-deb-stretch.sh
Install docker runtime for debian stretch
# Install Docker from Ubuntu's repositories:
sudo apt-get update
sudo apt-get install -y docker.io
# or install Docker CE 18.06 from Docker's repositories for Ubuntu or Debian:
## Install prerequisites.
sudo apt-get update && apt-get install apt-transport-https ca-certificates curl software-properties-common -y
## Download GPG key.