Skip to content

Instantly share code, notes, and snippets.

View eric54205420's full-sized avatar

Eric9400 eric54205420

View GitHub Profile
@eric54205420
eric54205420 / pdf_explain.py
Created September 28, 2024 01:23 — forked from htlin222/pdf_explain.py
This script splits a PDF file into individual pages and saves each page as a Markdown file with an auto-generated title and explanation in Traditional Chinese. It uses the OpenAI API to generate titles and explanations.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# title: pdf_explain
# author: Hsieh-Ting Lin, the Lizard 🦎
# description: This script splits a PDF file into individual pages and saves each page as a Markdown file with an auto-generated title and explanation in Traditional Chinese. It uses the OpenAI API to generate titles and explanations.
# date: "2024-07-13"
import os
import openai
@eric54205420
eric54205420 / execute_apps_script.py
Created April 29, 2024 07:46 — forked from vperezb/execute_apps_script.py
Execute Google Sheets Macro or Apps Script Programatically using python and Google Apps Script API
'''
Gist from the post https://medium.com/@victor.perez.berruezo/execute-google-apps-script-functions-or-sheets-macros-programmatically-using-python-apps-script-ec8343e29fcd
Code partially from Google Apps Script Quickstart https://developers.google.com/apps-script/api/quickstart/python
'''
import pickle
import os.path
from googleapiclient import errors
from googleapiclient.discovery import build
from google_auth_oauthlib.flow import InstalledAppFlow
@eric54205420
eric54205420 / exportSpreadsheet.gs
Created March 24, 2023 01:16 — forked from andrewroberts/exportSpreadsheet.gs
Example on how to export a Google sheet to various formats, includes most PDF options. Updated from comments in [Spencer Easton's Gist](https://gist.github.com/Spencer-Easton/78f9867a691e549c9c70)
function exportSpreadsheet() {
//All requests must include id in the path and a format parameter
//https://docs.google.com/spreadsheets/d/{SpreadsheetId}/export
//FORMATS WITH NO ADDITIONAL OPTIONS
//format=xlsx //excel
//format=ods //Open Document Spreadsheet
//format=zip //html zipped
@eric54205420
eric54205420 / LogAppsScriptConfig
Created March 24, 2023 01:12 — forked from andrewroberts/LogAppsScriptConfig
Log and clear the contents of Apps Script properties, triggers, etc
/**
* Clear all of the config
*/
function clearConfig() {
Logger.log('Delete Local Script Properties:')
if (PropertiesService.getScriptProperties() !== null) {
Logger.log(PropertiesService.getScriptProperties().deleteAllProperties())
Logger.log(' Deleted')
@eric54205420
eric54205420 / Flights - Custom Function.EXCEL.yaml
Created March 18, 2023 04:10 — forked from keyur32/Flights - Custom Function.EXCEL.yaml
Custom Function that gets flight information via PriceLine APIs.
name: Flights - Custom Function
description: Custom Function that gets flight information via PriceLine APIs.
host: EXCEL
api_set: {}
script:
content: |
/**
* Get routes
* @customfunction
* @param from - Outbound flight
const SECRET_KEY = ENTER YOUR SECRET KEY HERE;
const MAX_TOKENS = 200;
// For more cool AI snippets and demos, follow me on Twitter: https://twitter.com/_abi_
/**
* Completes your prompt with GPT-3
*
* @param {string} prompt Prompt
* @param {number} temperature (Optional) Temperature. 1 is super creative while 0 is very exact and precise. Defaults to 0.4.
@eric54205420
eric54205420 / README.md
Created November 3, 2022 03:40 — forked from sanhuang/README.md
繁簡體中文日文韓文的Unicode字元範圍

** 匹配Unicode字符的正則表達式

這裡是幾個主要非英文語系字符範圍(google上找到的):

  • 2E80~33FFh:中日韓符號區。收容康熙字典部首、中日韓輔助部首、注音符號、日本假名、韓文音符,中日韓的符號、標點、帶圈或帶括符文數字、月份,以及日本的假名組合、單位、年號、月份、日期、時間等。
  • 3400~4DFFh:中日韓認同表意文字擴充A區,總計收容6,582個中日韓漢字。
  • 4E00~9FFFh:中日韓認同表意文字區,總計收容20,902個中日韓漢字。
  • A000~A4FFh:彝族文字區,收容中國南方彝族文字和字根。
  • AC00~D7FFh:韓文拼音組合字區,收容以韓文音符拼成的文字。
  • F900~FAFFh:中日韓兼容表意文字區,總計收容302個中日韓漢字。
  • FB00~FFFDh:文字表現形式區,收容組合拉丁文字、希伯來文、阿拉伯文、中日韓直式標點、小符號、半角符號、全角符號等。
@eric54205420
eric54205420 / gmailAutoArchive.js
Created September 27, 2022 02:25 — forked from GabeBenjamin/gmailAutoArchive.js
Google script to automatically archive emails after x number of days.
// Original author fwed (contact@fwed.fr)
// Modified from
// https://gist.github.com/anonymous/2cca33d376f7f924fdaa67891ad098cc
// https://medium.com/@fw3d/auto-archive-emails-in-gmail-after-2-days-1ebf0e076b1c
function gmailAutoArchive() {
gmailAutoarchiveHelper(1);
gmailAutoarchiveHelper(2);
gmailAutoarchiveHelper(3);
gmailAutoarchiveHelper(7);
@eric54205420
eric54205420 / gmailCleanup.js
Created September 27, 2022 02:23 — forked from gabmontes/gmailCleanup.js
Google Apps script to cleanup messages from GMail.
// Inspired in http://www.johneday.com/422/time-based-gmail-filters-with-google-apps-script
// Deletes old marked conversations
function cleanUp() {
var delayDays = 5; // # of days before messages are moved to trash
var label = "Delete me"; // label to identify the messages
var maxDate = new Date(Date.now() - delayDays * 24 * 60 * 60 * 1000);
var userLabel = GmailApp.getUserLabelByName(label);
if (!userLabel) {
return;
@eric54205420
eric54205420 / LICENSE.txt
Created April 27, 2019 07:32 — forked from neizod/LICENSE.txt
Fibonacci (Recursive Lambda)
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2012 Nattawut Phetmak <http://about.me/neizod>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE