Skip to content

Instantly share code, notes, and snippets.

View itbj's full-sized avatar
🌴
On vacation

taoza itbj

🌴
On vacation
View GitHub Profile
#main.py
from fastapi import FastAPI,Body, Depends
import schemas
import models
from database import Base, engine, SessionLocal
from sqlalchemy.orm import Session
#This will create our database if it doesent already exists
Base.metadata.create_all(engine)
def get_session():
session = SessionLocal()
@miguelmota
miguelmota / config
Last active April 29, 2024 04:57
Arch linux VNC server setup
session=lxqt
geometry=1920x1080
localhost # comment this out to allow connections from anywhere
alwaysshared
{
"final_space": true,
"console_title": true,
"console_title_style": "folder",
"blocks": [
{
"type": "prompt",
"alignment": "left",
"horizontal_offset": 0,
"vertical_offset": 0,
@Marmiz
Marmiz / main.rs
Last active March 4, 2024 19:12
Final section of todo-cli
use std::collections::HashMap;
fn main() {
let action = std::env::args().nth(1).expect("Please provide an action");
let item = std::env::args().nth(2).expect("Please provide an item");
let mut todo = Todo::new().expect("Initialisation of db failed");
if action == "add" {
todo.insert(item);
@shanselman
shanselman / ohmyposhv3.json
Created December 23, 2020 03:48
My ohMyPoshv3 json
{
"final_space": true,
"console_title": true,
"console_title_style": "folder",
"blocks": [
{
"type": "prompt",
"alignment": "left",
"horizontal_offset": 0,
"vertical_offset": 0,

Install Minikube with virtual-box VM driver

$ brew update && brew install kubectl && brew cask install docker minikube virtualbox
$ brew cask reinstall minikube
$ minikube delete
$ rm -fr ~/.minikube/
@raeq
raeq / strings_00_substring.py
Created July 18, 2020 10:33
Find a needle in a haystack
def sub_00(haystack: str="", needle:str="") -> bool:
return needle in haystack
assert sub_00("the quick brown fox jumped over the lazy dog", "lazy") == True
assert sub_00("the quick brown fox jumped over the lazy dog", "lazys") == False
@maxtacu
maxtacu / countertimer.py
Last active February 12, 2022 14:28
Python countdown timer https://youtu.be/9QSo3F6sM1w
import time
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('-t', '--time', type=int, required=True, help="Time in seconds")
parser.add_argument('-o', '--output',default="counter.txt", help="Output file")
args = parser.parse_args()
def countdown(t):
while t:
@itbj
itbj / Dockerfile
Created February 1, 2020 03:47 — forked from MichalZalecki/Dockerfile
Install oh-my-zsh in Docker
RUN ["apt-get", "update"]
RUN ["apt-get", "install", "-y", "zsh"]
RUN wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh || true
# docker exec -it my-app-container /bin/zsh
@itbj
itbj / Setup Pivot Table
Created June 14, 2019 12:52 — forked from stevehenderson/Setup Pivot Table
VBA code to initialize a PivotTable
'SetupPivot: The following subroutine sets up a pivot table
'
'
' author: steven.henderson@usma.edu
'
'I received assitance from the following site:
'