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
#!/bin/bash
# turn GCP (Google Cloud Platform) metadata key/values into shell environment variables
# Function to fetch metadata and set as environment variable
fetch_and_export() {
local path=$1
local value=$(curl "http://metadata.google.internal/computeMetadata/v1/${path}" -H "Metadata-Flavor: Google" --silent)
if [ $? -eq 0 ] && [ ! -z "$value" ]; then
# Convert metadata keys to uppercase and replace invalid characters for shell variable names
# To automatically start tmux on a remote system
# add this to the ~/.ssh/config Host stanzas
# Host remote-with-tmux
# RequestTTY yes
# RemoteCommand tmux new -A
# see also: https://github.com/tmux/tmux/wiki/Clipboard
# and also: https://blog.jbowen.dev/tips/ssh-tmux/
# and also: https://www.freecodecamp.org/news/tmux-in-practice-integration-with-system-clipboard-bcd72c62ff7b/
@aculich
aculich / using-details-summary-github.md
Created December 7, 2022 20:36 — forked from scmx/using-details-summary-github.md
Using <details> <summary> expandable content on GitHub with Markdown #details #summary #markdown #gfm #html

How to use <details> <summary> expandable content on GitHub with Markdown

Firstly, what is <details> <summary>?

The HTML Details Element (<details>) creates a disclosure widget in which information is visible only when the widget is toggled into an "open" state. A summary or label can be provided using the <summary> element. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/details.

Example

@aculich
aculich / homebrew-gnubin.md
Created November 28, 2022 19:42 — forked from skyzyx/homebrew-gnubin.md
Using GNU command line tools in macOS instead of FreeBSD tools

macOS is a Unix, and not built on Linux.

I think most of us realize that macOS isn't a Linux OS, but what that also means is that instead of shipping with the GNU flavor of command line tools, it ships with the FreeBSD flavor. As such, writing shell scripts which can work across both platforms can sometimes be challenging.

Homebrew

Homebrew can be used to install the GNU versions of tools onto your Mac, but they are all prefixed with "g" by default.

All commands have been installed with the prefix "g". If you need to use these commands with their normal names, you can add a "gnubin" directory to your PATH from your bashrc.

@aculich
aculich / android_instructions.md
Created September 23, 2022 01:17 — forked from patrickhammond/android_instructions.md
Easily setup an Android development environment on a Mac

Here is a high level overview for what you need to do to get most of an Android environment setup and maintained.

Prerequisites (for Homebrew at a minimum, lots of other tools need these too):

  • XCode is installed (via the App Store)
  • XCode command line tools are installed (xcode-select --install will prompt up a dialog)
  • Java

Install Homebrew:

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"

@aculich
aculich / when2meet-subset.js
Created September 22, 2022 09:53 — forked from edemaine/when2meet-subset.js
Enable toggling subset of users in when2meet results view
// paste this into your browser console when looking at when2meet results
if (!window.OrigAvailableAtSlot) window.OrigAvailableAtSlot = AvailableAtSlot;
if (!window.OrigAvailableIDs) window.OrigAvailableIDs = AvailableIDs;
let nameFilter;
if (nameFilter = document.getElementById('NameFilter')) nameFilter.remove();
nameFilter = document.createElement('ul');
nameFilter.id = 'NameFilter';
document.getElementById('LeftPanel').appendChild(nameFilter);
const idOn = (id) => document.getElementById(id).checked;
for (let i = 0; i < PeopleNames.length; i++) {
@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;