Skip to content

Instantly share code, notes, and snippets.

@sureshjoshi
sureshjoshi / update-pants-repos.sh
Created April 29, 2024 02:41
Updating Pants example repos
#! /bin/bash
VERSION="$1"
OWNER="${2:-sureshjoshi}"
echo "Updating all repos to use pants version $VERSION for owner $OWNER"
if [ -z "$VERSION" ]; then
echo "Please provide a version string as the first argument."
exit 1
fi
@sureshjoshi
sureshjoshi / BUILD.pants (Ansible)
Last active May 26, 2023 19:05
Pants adhoc_tool recipes
Test
@sureshjoshi
sureshjoshi / social-auth-existing-user.test.ts
Last active April 16, 2023 14:16
Perform signInWithPopup using Playwright and the Firebase Emulator
test("User should be able to sign-in via social auth", async ({
page,
}) => {
const socialLoginButton = page.getByRole("button", { name: /google/i });
await socialLoginButton.click();
// This is the important bit - waiting for a popup event, and letting that page stabilize first
const popup = await page.waitForEvent("popup");
await popup.waitForLoadState("networkidle");
@sureshjoshi
sureshjoshi / pants-completion.bash
Created March 19, 2023 05:40
Dynamic bash completions for Pants.
function pants_completions()
{
# Get MD5 hash of pants.toml and create a reliable tmp directory with it
local -r PANTS_TOML_MD5=$(md5sum pants.toml | awk '{print $1}')
local -r PANTS_TMPFILE="$TMPDIR/pants_completion_$PANTS_TOML_MD5"
# Check if the cached Pants help JSON file exists, if not create it
if [ ! -f "$PANTS_TMPFILE" ]; then
cache_help_json "$PANTS_TMPFILE"
### NOTE: This is strictly a breakdown of the snippets from the blog article, not an automated script.
### For automation, refer to the Ansible role
### Setup a Static IP
nano /etc/dhcpcd.conf
# Add these fields with your desired IP address
> interface eth0
> static ip_address=10.10.10.1/24
> static routers=10.10.10.0
#!/usr/bin/env python
import socket
import sys
if len(sys.argv) < 3:
print("Usage: wakeonlan.py <ADR> <MAC> (example: 192.168.1.255 00:11:22:33:44:55)")
sys.exit(1)
mac = sys.argv[2]
@sureshjoshi
sureshjoshi / gist:4566f04da8d5431ddbe0e23cffce2185
Created April 27, 2018 20:33
OfficeJS Issue #106 - Word 2016 crashes when insertOoxml with footnotes with non-matching IDs
name: Word crash
description: ''
host: WORD
api_set: {}
script:
content: |-
$("#run").click(() => tryCatch(run));
$("#crash").click(() => tryCatch(crash));
async function writeXml(context, xml) {