Skip to content

Instantly share code, notes, and snippets.

View Babatunde13's full-sized avatar
🎯
Focusing

Babatunde Mudathir Koiki Babatunde13

🎯
Focusing
View GitHub Profile
@Babatunde13
Babatunde13 / week1.md
Created February 15, 2020 07:21
Week 1 assignment explanation

Following instructions strictly

You had X points should be out of the loop

String methods can be used to change a string: .lower, .upper, .title etc

Difference between .choice and .choices in the random module

In every if statement that has an elif statement there must be an else statement

Someone used a function and did not return anything in the function and he's trying to use a variable that's inside the function outside.

Writing a neat code

Sample mean and Population mean

Getting user input.: int, float, eva and getting texts from user.

@Babatunde13
Babatunde13 / app.py
Last active March 31, 2024 08:41
The first part of my Flask and SQLAlchemy series.
from flask import Flask, jsonify, request
from flask_sqlalchemy import SQLAlchemy
import uuid
app = Flask(__name__)
db = SQLAlchemy(app)
app.config['SECRET_KEY']='secret'
app.config['SQLALCHEMY_DATABASE_URI']='sqlite:///app.db'
import graphene
import json, csv
from datetime import datetime
from flask import Flask
from flask_graphql import GraphQLView
app = Flask(__name__)
class User(graphene.ObjectType):
id = graphene.ID()
@Babatunde13
Babatunde13 / node_nginx_ssl.md
Created August 29, 2021 14:34 — forked from bradtraversy/node_nginx_ssl.md
Node app deploy with nginx & SSL

Node.js Deployment

Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt

1. Sign up for Digital Ocean

If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5424d440c63a

2. Create a droplet and log in via ssh

I will be using the root user, but would suggest creating a new user

@Babatunde13
Babatunde13 / trees.ts
Created January 9, 2023 12:39
A simple TypeScript functions to show how the trees data structues are implemented
function walkPreTree(curr: BinaryNode<number> | undefined, path: number[]): number[] {
if (!curr) return path
path.push(curr.value)
walkPreTree(curr.left, path)
walkPreTree(curr.right, path)
return path
}
function walkInTree(curr: BinaryNode<number> | undefined, path: number[]): number[] {
if (!curr) return path
@Babatunde13
Babatunde13 / bank-api.md
Created September 28, 2023 17:06
Bank And Account Simulation

Project: Simple Bank Application

Problem Statement:

You are tasked with building a simple bank application in Java that allows users to create bank accounts, view account details, deposit, withdraw, and transfer money between accounts. You should also implement a Bank class to manage these accounts.

Class Structure:

  1. Bank Class:
@Babatunde13
Babatunde13 / redux.ts
Created June 18, 2024 15:40
redux setup
import { createStore } from 'redux'
type OPEN_MODAL = {
type: 'OPEN_MODAL'
modal_type: string
}
type CLOSE_MODAL = {
type: 'CLOSE_MODAL'
}
package main
import (
"fmt"
)
func Sqrt(x float64) float64 {
guess := 1.0
var lastGuess float64
var lastTwoGuess float64
def getInput(availablePositions):
print("Available positions πŸ‘‡πŸ½")
print(availablePositions)
rowIdx = int(input('Which row are you playing? '))
colIdx = int(input('Which column are you playing? '))
while [rowIdx, colIdx] not in availablePositions:
print("Position not available")
getInput(availablePositions)
import boto3, os
class PyS3:
def __init__(self, ACCESS_KEY, SECRET_KEY):
self.s3 = boto3.resource('s3', aws_access_key_id=ACCESS_KEY, aws_secret_access_key=SECRET_KEY)
def allow_or_prevent_public_access(self, bucket_name, secure=False):
try:
self.s3.meta.client.put_public_access_block(
Bucket=bucket_name,