Skip to content

Instantly share code, notes, and snippets.

View pleabargain's full-sized avatar
🏠
office

Dennis pleabargain

🏠
office
View GitHub Profile
# watch the series to see how the whole thing is assembled
#source https://www.youtube.com/watch?v=tQprNCwjMlk&t=71s
# credit https://www.youtube.com/@databeliever
import gspread
import random
from datetime import datetime
import flet as ft
from time import sleep
@pleabargain
pleabargain / getfuncywithpython.py
Created November 1, 2022 13:16
python manipulating text variable using a list of functions as a variable
# very long sample text
text = "This is a very long sample text. It is so long that it will be used to demonstrate the use of functions as variables. It is also used to demonstrate the use of functions as arguments to other functions. It is also used to demonstrate the use of functions as return values from other functions. It is also used to demonstrate the use of functions as items in lists. It is also used to demonstrate the use of functions as items in tuples. It is also used to demonstrate the use of functions as items in dictionaries. It is also used to demonstrate the use of functions as items in sets. It is also used to demonstrate the use of functions as items in frozen sets. It is also used to demonstrate the use of functions as items in comprehensions. It is also used to demonstrate the use of functions as items in generator expressions. It is also used to demonstrate the use of functions as items in class definitions"
#function print all unique words in text
def print_unique_words(text):
retu
@pleabargain
pleabargain / findprimes.py
Created October 31, 2022 13:20
find all prime numbers in a range (used github copilot)
# find all prime numbers in a range
# range is 100
for i in range(2,101):
for j in range(2,i):
if i % j == 0:
break
else:
print(i)
@pleabargain
pleabargain / newfizzbuzz.py
Last active October 31, 2022 13:01
fizz buzz with the help of github copilot using elif
# 1, 2, fizz, 4, buzz,fizz,7,8,fizz,buzz,11,fizz,13,14,fizzbuzz,16,17,fizz,19,buzz,fizz,22,23,fizz,buzz,26,fizz,28,29,fizzbuzz,31,32,fizz,34,buzz,fizz,37,38,fizz,buzz,41,fizz,43,44,fizzbuzz,46,47,fizz,49,buzz,fizz,52,53,fizz,buzz,56,fizz,58,59,fizzbuzz,61,62,fizz,64,buzz,fizz,67,68,fizz,buzz,71,fizz,73,74,fizzbuzz,76,77,fizz,79,buzz,fizz,82,83,fizz,buzz,86,fizz,88,89,fizzbuzz,91,92,fizz,94,buzz,fizz,97,98,fizz,buzz
# range 101
for i in range(1,101):
if i % 3 == 0 and i % 5 == 0:
print('fizzbuzz')
elif i % 3 == 0:
print('fizz')
elif i % 5 == 0:
print('buzz')
@pleabargain
pleabargain / draw_an_X_in_a_box.py
Last active October 21, 2022 13:33
asci drawing tool mostly written by Ryan Mitchell
import os
import time
from termcolor import colored
import math
'''
. . . . . . . . . . . . . . . . . . . . . *
. . . .
. . . .
. . . .
@pleabargain
pleabargain / ps1
Last active September 15, 2022 13:23
a slightly better powershell demo of writing user input from console to a text
# this is just a simple powershell console toy
# minute stamp helps me find newest output
$minute = (Get-Date).Minute
$name = Read-Host -Prompt "Please enter your name"
$game = Read-Host -Prompt "Do you want to play a question game?"
# if game is yes, then Write-Output
if ($game -eq 'yes') {
Write-Output "Hello $name, let's play a game!"
@pleabargain
pleabargain / ps1
Created September 15, 2022 12:17
simple powershell toy demonstrating variables in file names and creation of files
# this is just a simple powershell console toy
# minute stamp helps me find newest output
$minute = (Get-Date).Minute
$name = Read-Host -Prompt "Please enter your name"
$game = Read-Host -Prompt "Do you want to play a question game?"
# if game is yes, then Write-Output
if ($game -eq 'yes') {
Write-Output "Hello $name, let's play a game!"
@pleabargain
pleabargain / text_to_directories.ps1
Created April 24, 2022 04:33
create new directories using a text file as source
# countries variable is a list of text strings
# in the file named 'countries.txt'
$countries = Get-Content -Path "C:\Users\denni\OneDrive\Documents\powershell_create_dir\countries.txt"
# loop through the countries list
# and create a directory for each one
# use the New-Item cmdlet
# item type is directory
@pleabargain
pleabargain / gist:f25fbaa1645d13d8eb6c76cfcca451b2
Created April 23, 2022 09:01
copilot github create SQL from CSV
# inspired by https://www.geeksforgeeks.org/how-to-import-a-csv-file-into-a-sqlite-database-table-using-python/
# create sql from csv
# import required modules
import csv
import sqlite3
from multiprocessing import connection
# create phrasal_verb database
conn = sqlite3.connect('phrasal_verb.db')
@pleabargain
pleabargain / import a csv file into SQL using python
Created April 23, 2022 08:03
this is a demo of importing CSV into SQLite using python
# inspired by https://www.geeksforgeeks.org/how-to-import-a-csv-file-into-a-sqlite-database-table-using-python/
# create sql from csv
# import required modules
import csv
from multiprocessing import connection
import sqlite3
# create phrasal_verb database
connection = sqlite3.connect('phrasal_verb.db')