Skip to content

Instantly share code, notes, and snippets.

version: '3.3'
services:
db:
image: nginx:alpine
volumes:
- db_data:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: somewordpress
@avielb
avielb / fibo.py
Last active January 6, 2023 09:59
def fib(n): # write Fibonacci series up to n
a, b = 0, 1
while b < n:
print(b)
a, b = b, a+b
def fib2(n): # return Fibonacci series up to n
result = []
a, b = 0, 1
while b < n:
import requests
def save_name():
n = input("enter your name: ")
my_file = open("names.txt", "a")
my_file.write(f"{n}\n")
def show_names():
with open("names.txt") as moshe:
import boto3
client = boto3.client("ec2")
def get_instance_ids(client):
my_instances = client.describe_instances()
instance_ids_to_return = []
for reservation in my_instances["Reservations"]:
for instance in reservation["Instances"]:
numbers = [
951, 402, 984, 651, 360, 69, 408, 319, 601, 485, 980, 507, 725, 547, 544,
615, 83, 165, 141, 501, 263, 617, 865, 575, 219, 390, 984, 592, 236, 105, 942, 941,
386, 462, 47, 418, 907, 344, 236, 375, 823, 566, 597, 978, 328, 615, 953, 345,
399, 162, 758, 219, 918, 237, 412, 566, 826, 248, 866, 950, 626, 949, 687, 217,
815, 67, 104, 58, 512, 24, 892, 894, 767, 553, 81, 379, 843, 831, 445, 742, 717,
958, 609, 842, 451, 688, 753, 854, 685, 93, 857, 440, 380, 126, 721, 328, 753, 470,
743, 527
]
# import flask package
from flask import Flask
# create a flask application. we will use it to run the app later
app = Flask(__name__)
# define an http path to match a python function, in this case when going to http://127.0.0.1:5000/
# this function will be called. it's return will be used to response the http call
@app.route('/')
def home():
https://gist.github.com/avielb/98393e1fa37c6a66be1df34be68087d3
# Conditionals
isTrue = False
a = 2
b = 2.5
strOne = "One"
strThree = "Three"
if a < b:
@avielb
avielb / untaint.yaml
Created December 2, 2020 07:09
Daemonset to automatically remove AKS spot instances default taint
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: untaint
rules:
- apiGroups:
- ""
resources:
- nodes
@avielb
avielb / bla.py
Last active September 7, 2020 17:01
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello! I am a Flask application'
if __name__ == '__main__)':
app.run(host='0.0.0.0')
import pymysql
conn = pymysql.connect(host='127.0.0.1', port=3306, user='root', passwd='my-secret-pw', db='tips', autocommit=True)
import pymysql
conn = pymysql.connect(host='database-1.c65uwrrkzb8g.us-east-1.rds.amazonaws.com',
port=3306, user='admin', passwd='Aa123123', db='aviel', autocommit=True)