Skip to content

Instantly share code, notes, and snippets.

View pleabargain's full-sized avatar
🏠
office

Dennis pleabargain

🏠
office
View GitHub Profile
@pleabargain
pleabargain / will send selected line from google sheets by email. At this time it will only send one selected line.txt
Created September 16, 2024 05:53
will send selected line from google sheets by email. At this time it will only send one selected line
--.gs--
function onOpen(e) {
SpreadsheetApp.getUi()
.createMenu('Custom Menu')
.addItem('Cool Trick', 'showSidebar')
.addToUi();
}
function showSidebar() {
var html = HtmlService.createHtmlOutputFromFile('Sidebar')
@pleabargain
pleabargain / Google apps script to replace EXACT strings with a different string.js
Created September 11, 2024 12:51
Google apps script to replace EXACT strings with a different string
function onOpen() {
var ui = SpreadsheetApp.getUi();
ui.createMenu('Custom Tools')
.addItem('Find and Replace', 'findAndReplace')
.addToUi();
}
function findAndReplace() {
var sheet = SpreadsheetApp.getActiveSheet();
var range = sheet.getActiveRange();
@pleabargain
pleabargain / instructions for setting up .Appimage
Created September 5, 2024 08:25
instructions for setting up links to to an APPIMAGE .AppImage
To make your AppImage accessible via command line and set it as an application option when right-clicking files, you'll need to follow these steps:
1. Make the AppImage executable:
Open a terminal and navigate to your Downloads folder, then make the AppImage executable:
```
cd ~/Downloads
chmod +x cursor-0.40.3-build-240829epqamqp7h-x86_64.AppImage
```
@pleabargain
pleabargain / python form filler
Last active September 5, 2024 08:25
simple python form filler. supply a form with text in [brackets] create a csv with headers with matchin [brackets] and run the code.
import csv
import os
def read_csv(filename):
data = []
with open(filename, 'r') as csvfile:
reader = csv.DictReader(csvfile)
for row in reader:
if any(row.values()): # Check if the row is not empty
data.append(row)
@pleabargain
pleabargain / topsellercsv.py
Created September 3, 2024 06:39
will total up a CSV and do a sanity check to make sure the sums match. I used this to determine top sellers
import pandas as pd
from collections import defaultdict
import sys
# Redirect print output to both console and file
class Logger(object):
def __init__(self, filename="output.txt"):
self.terminal = sys.stdout
self.log = open(filename, "w")
@pleabargain
pleabargain / copyjpg.py
Created August 15, 2024 14:34
searches root directory and copies all JPG to a new folder
import os
import shutil
def copy_jpg_images(source_folder, destination_folder):
# Create the destination folder if it doesn't exist
if not os.path.exists(destination_folder):
os.makedirs(destination_folder)
folder_count = 0
image_count = 0
@pleabargain
pleabargain / email.js
Created April 5, 2024 07:47
write a Google apps script that checks active spreadsheet use these column headers: nameColIndex emailColIndex dateColIndex for dates gets name and email from the spreadsheet opens a draft email writes a birthday wish save the email as a draft include detailed logs in the console for debugging
function sendBirthdayEmails() {
const sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
const data = sheet.getDataRange().getValues();
const headers = data.shift(); // Remove the header row for processing
// Identify the index of each column based on the header
const nameColIndex = headers.indexOf("Name");
const emailColIndex = headers.indexOf("Email");
const dateColIndex = headers.indexOf("Date");
# 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)