Skip to content

Instantly share code, notes, and snippets.

View aculich's full-sized avatar
😀
Having fun exploring repos for Computational Text Analysis with D-Lab CTAWG

Aaron Culich aculich

😀
Having fun exploring repos for Computational Text Analysis with D-Lab CTAWG
View GitHub Profile
@aculich
aculich / base32.js
Created September 18, 2022 15:35 — forked from kiasaki/base32.js
Base32 encode/decode in Javascript
// From https://technote.fyi/code/javascript/base32-encoding-and-decoding-in-javascript/
(function(exports) {
var base32 = {
a: "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",
pad: "=",
encode: function (s) {
var a = this.a;
var pad = this.pad;
var len = s.length;
var o = "";
@aculich
aculich / export_when2meet.js
Last active March 13, 2024 09:22 — forked from camtheman256/export_when2meet.js
Export when2meet data from JS console
function getCSV() {
result = "Time," + PeopleNames.join(",")+"\n";
for(let i = 0; i < AvailableAtSlot.length; i++) {
let slot = $x(`string(//div[@id="GroupTime${TimeOfSlot[i]}"]/@onmouseover)`);
slot = slot.match(/.*"(.*)".*/)[1];
result += slot + ",";
result += PeopleIDs.map(id => AvailableAtSlot[i].includes(id) ? 1 : 0).join(",");
result+= "\n";
}
console.log(result);
@aculich
aculich / tweet_dumper.py
Last active June 13, 2022 18:32 — forked from yanofsky/LICENSE
A script to download all of a user's tweets into a csv
#!/usr/bin/env python
# encoding: utf-8
### Upstream code: https://gist.github.com/yanofsky/5436496#file-tweet_dumper-py
### Upstream LICENSE: https://gist.github.com/yanofsky/5436496#file-license
import tweepy #https://github.com/tweepy/tweepy
import csv
#Twitter API credentials
@aculich
aculich / Code.gs
Created May 25, 2022 02:31 — forked from rheajt/Code.gs
function doGet(e) {
if(!e.parameters.sheetId) {
return HtmlService.createTemplateFromFile('Start').evaluate().setSandboxMode(HtmlService.SandboxMode.IFRAME);
} else {
var html = HtmlService.createTemplateFromFile('Viewer');
//set variable of sheet id to post in hidden input field for async request when page loads
html.sheetName = SpreadsheetApp.openById(e.parameters.sheetId).getName();
html.sheetId = e.parameters.sheetId;
@aculich
aculich / simple-hash.js
Created May 15, 2022 20:38 — forked from jlevy/simple-hash.js
Fast and simple insecure string hash for JavaScript
// This is a simple, *insecure* hash that's short, fast, and has no dependencies.
// For algorithmic use, where security isn't needed, it's way simpler than sha1 (and all its deps)
// or similar, and with a short, clean (base 36 alphanumeric) result.
// Loosely based on the Java version; see
// https://stackoverflow.com/questions/6122571/simple-non-secure-hash-function-for-javascript
const simpleHash = str => {
let hash = 0;
for (let i = 0; i < str.length; i++) {
const char = str.charCodeAt(i);
hash = (hash << 5) - hash + char;
@aculich
aculich / tellmeyoursecrets.js
Created April 20, 2022 11:58 — forked from woodwardtw/tellmeyoursecrets.js
google script that lists a lot of info about the files in a particular folder/sub folder structure including viewers, editors, and sharing permissions
function listFolders(folder) {
var sheet = SpreadsheetApp.getActiveSheet();
sheet.appendRow(["Name", "Sharing Access", "Sharing Permission", "Get Editors", "Get Viewers", "Date", "Size", "URL", "Download", "Description", "Type"]); //writes the headers
var folder = DriveApp.getFolderById("YOUR_FOLDER_ID");//that long chunk of random numbers/letters in the URL when you navigate to the folder
var files = folder.getFiles();//initial loop on loose files w/in the folder
var cnt = 0;
var file;
@aculich
aculich / clean-toc.gs
Created March 29, 2022 01:21 — forked from marcorei/clean-toc.gs
Google Apps Script which cleans the Table of Content from unwanted headings.
/**
* Creates a menu entry in the Google Docs UI when the document is opened.
*
* @param {object} e The event parameter for a simple onOpen trigger. To
* determine which authorization mode (ScriptApp.AuthMode) the trigger is
* running in, inspect e.authMode.
*/
function onOpen(e) {
DocumentApp.getUi().createAddonMenu()
.addItem('Clean Table of Contents', 'cleanToC')

Google Apps Script Spreadsheet Utilities and Custom Functions#

These utilities are grouped into related files, for simpler copy & paste to your scripts.

ConvertA1.gs

A couple of helper functions to convert to & from A1 notation.

cellA1ToIndex( string cellA1, number index )

@aculich
aculich / submit.md
Created October 2, 2021 18:40 — forked from tanaikech/submit.md
Sorting Cells on Google Spreadsheet with Background colors using Google Apps Script

Sorting Cells on Google Spreadsheet with Background colors using Google Apps Script

This is a sample script for sorting the cells on Google Spreadsheet with the background colors using Google Apps Script.

Unfortunately, in the current stage, it seems that sort(sortSpecObj) of Class Range cannot directly sort by the background colors of cells. But when Sheets API is used, this goal can be achieved. Here, "SortRangeRequest" of the method of "spreadsheets.batchUpdate" in Sheets API is used.

Flow

@aculich
aculich / GithubClient.gs
Created September 24, 2021 09:11 — forked from pamelafox/GithubClient.gs
Google Apps Script for committing a file to Github Repo
/* A bare-bones GithubClient, just used for commits */
function GithubClient(owner, repo, username, passwordOrToken) {
this.owner = owner;
this.repo = repo;
this.username = username;
this.passwordOrToken = passwordOrToken;
}
/*