Skip to content

Instantly share code, notes, and snippets.

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:
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():
@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
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"]:
@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')
@avielb
avielb / a.yaml
Created June 27, 2020 10:13
a.yaml
apiVersion: v1
kind: Service
metadata:
name: nginx
spec:
selector:
name: nginx
type: NodePort
ports:
- name: foo # Actually, no port is needed.
properties([parameters([string(defaultValue: 'aviel', description: 'what is your name?', name: 'NAME', trim: false), booleanParam(defaultValue: false, description: 'or not to be?', name: 'to_be'), password(defaultValue: '', description: 'enter the secret ', name: 'SECRET'), choice(choices: ['option_1', 'option_2', 'option_3'], description: 'choose an option!', name: 'my_choice')]), pipelineTriggers([cron('*/2 * * * *')])])
my_name = "Blabla"
def getStartBanner () {
return '''******************
* START *
******************'''
}
node {
timestamps {
# define a function that it's input is 2 variables
# the function will return the sum of two numbers
def add_numbers(first_number, second_number):
return first_number + second_number
# input for two numbers, we will ask for input and cast the numbers
x = int(input("enter first number: "))
y = int(input("enter second number: "))
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)