Skip to content

Instantly share code, notes, and snippets.

@jdmonty
jdmonty / Basic API call (TypeScript).WORD.yaml
Created December 29, 2023 01:52
Performs a basic Word API call using TypeScript.
name: Basic API call (TypeScript)
description: Performs a basic Word API call using TypeScript.
host: WORD
api_set: {}
script:
content: |
$("#run").click(() => tryCatch(run));
async function run() {
// Gets the current selection and changes the font color to red.
@jdmonty
jdmonty / Basic API call (TypeScript).WORD.yaml
Created December 29, 2023 01:47
Performs a basic Word API call using TypeScript.
name: Basic API call (TypeScript)
description: Performs a basic Word API call using TypeScript.
host: WORD
api_set: {}
script:
content: |
$("#run").click(() => tryCatch(run));
async function run() {
// Gets the current selection and changes the font color to red.
@jdmonty
jdmonty / git-setup.sh
Created November 22, 2023 16:17 — forked from rdundon/git-setup.sh
Git and Node with Zscaler proxy
#!/bin/sh
# Git proxy settings
echo "Configuring Git for compatibility with ZScaler..."
git config --global http.proxy http://gateway.zscaler.net:80/
git config --system http.proxy http://gateway.zscaler.net:80/
@jdmonty
jdmonty / idb-backup-and-restore.md
Created July 5, 2023 10:07 — forked from loilo/idb-backup-and-restore.md
Back up and restore an IndexedDB database

Back up and restore an IndexedDB database

This gist is an ES module which provides functions to import and export data from an IndexedDB database as JSON. It's based on Justin Emery's indexeddb-export-import package, but applies some adjustments that reflect better on the current browser landscape (i.e. better developer ergonomics but no support for Internet Explorer).

Usage

For each of the provided functionalities, you need a connected IDBDatabase instance.

Export Data

import { idb } from 'some-database'
@jdmonty
jdmonty / setup.sh
Last active May 8, 2023 09:50
Arch Linux Setup Script
#!/bin/bash
#
# Arch Linux installation
#
# Bootable USB:
# - [Download](https://archlinux.org/download/) ISO and GPG files
# - Verify the ISO file: `$ pacman-key -v archlinux-<version>-dual.iso.sig`
# - Create a bootable USB with: `# dd if=archlinux*.iso of=/dev/sdX && sync`
#
# UEFI setup:
@jdmonty
jdmonty / rust-command-line-utilities.markdown
Created December 3, 2022 10:04 — forked from sts10/rust-command-line-utilities.markdown
A curated list of command-line utilities written in Rust

A curated list of command-line utilities written in Rust

Note that I have not tried all of these personally, and cannot and do not vouch for all of the tools listed here. In most cases, the descriptions here are copied directly from their code repos. Some may have been abandoned. Investigate before installing/using.

The ones I use regularly include: bat, dust, exa, fd, hyperfine, miniserve, ripgrep, just, zoxide and cargo-wipe.

  • atuin: "Magical shell history"
  • bandwhich: Terminal bandwidth utilization tool
  • bat: A replacement for cat that provides syntax highlighting and other features.
  • bottom: Yet another cross-platform graphical process/system monitor.
@jdmonty
jdmonty / Quirks of C.md
Created November 20, 2022 22:34 — forked from fay59/Quirks of C.md
Quirks of C

Here's a list of mildly interesting things about the C language that I learned mostly by consuming Clang's ASTs. Although surprises are getting sparser, I might continue to update this document over time.

There are many more mildly interesting features of C++, but the language is literally known for being weird, whereas C is usually considered smaller and simpler, so this is (almost) only about C.

1. Combined type and variable/field declaration, inside a struct scope [https://godbolt.org/g/Rh94Go]

struct foo {
   struct bar {
 int x;
@jdmonty
jdmonty / summers.hs
Created October 4, 2022 19:12 — forked from LFY/summers.hs
Partial implementation of LISP program synthesis
-- Analytic inductive programming, according to survey paper:
-- Kitzelmann, Emanuel. Inductive Programming: A Survey of Program Synthesis Techniques
-- Other related work:
-- D.R. Smith. The synthesis of LISP programs from examples: A survey.
-- P.D. Summers. A Methodology for LISP program construction from examples.
-- Author: Lingfeng Yang
@jdmonty
jdmonty / unit.sh
Created October 4, 2022 11:53 — forked from ptc-mrucci/unit.sh
Bash test: get the directory of a script
#!/bin/bash
tmp=$(python -c "import os, sys; print(os.path.realpath('/tmp'))")
function test {
MESSAGE=$1
RECEIVED=$2
EXPECTED=$3
if [ "$RECEIVED" = "$EXPECTED" ]; then
@jdmonty
jdmonty / expecting.md
Created September 8, 2022 00:35 — forked from ksafranski/expecting.md
Basic principles of using tcl-expect scripts

Intro

TCL-Expect scripts are an amazingly easy way to script out laborious tasks in the shell when you need to be interactive with the console. Think of them as a "macro" or way to programmaticly step through a process you would run by hand. They are similar to shell scripts but utilize the .tcl extension and a different #! call.

Setup Your Script

The first step, similar to writing a bash script, is to tell the script what it's executing under. For expect we use the following:

#!/usr/bin/expect