This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--.gs-- | |
function onOpen(e) { | |
SpreadsheetApp.getUi() | |
.createMenu('Custom Menu') | |
.addItem('Cool Trick', 'showSidebar') | |
.addToUi(); | |
} | |
function showSidebar() { | |
var html = HtmlService.createHtmlOutputFromFile('Sidebar') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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) |
NewerOlder