Skip to content

Instantly share code, notes, and snippets.

View a11smiles's full-sized avatar

Joshua Davis a11smiles

View GitHub Profile
@a11smiles
a11smiles / free-pane-ptys.sh
Last active November 10, 2026 06:09
Free Pane's Leaked Terminals
#!/bin/bash
# Frees the pseudo-terminals Pane leaks on macOS (greenfield-inc/Pane#1083) without restarting Pane.
# A leaked handle is a /dev/ptmx master held by Pane whose terminal end (/dev/ttysN) no process has open
# and no process uses as its terminal. It must look leaked in two scans 5 s apart, and inside Pane each
# handle is checked again (same device, same terminal number) right before it is closed.
# Usage: free-pane-ptys.sh [--dry-run] [--min <n>] (acts only when at least <n> are leaked; default 50)
set -u
DRY=0; MIN=50; PORT=9229
while [ $# -gt 0 ]; do case "$1" in --dry-run) DRY=1;; --min) MIN="$2"; shift;; *) echo "unknown option $1"; exit 2;; esac; shift; done
PANE_BIN=/Applications/Pane.app/Contents/MacOS/Pane
@a11smiles
a11smiles / functions.php
Last active May 13, 2025 10:53
Weglot Translation Shortcode
function translate_shortcode( $atts = [], $content = null, $tag = '' ) {
// Get current URI and set cache timeout
$current_url = $_SERVER["REQUEST_URI"];
$cache_timeout = 86400;
// normalize attribute keys, lowercase
$atts = array_change_key_case( (array) $atts, CASE_LOWER );
// override default attributes with user attributes
$custom_atts = shortcode_atts(
choco install sqlite
sqlite3 grafana.db 'PRAGMA journal_mode=wal;'
az login
az storage copy -s .\grafana.db -d https://<storage_account>.file.core.windows.net/<file_share> --subscription <subscription_name>
import { Component, OnInit } from '@angular/core';
import { BasePageComponent } from '../base-page/base-page.component';
@Component({
selector: 'app-first-page',
templateUrl: './first-page.component.html',
styleUrls: ['./first-page.component.scss']
})
export class FirstPageComponent extends BasePageComponent implements OnInit {
private _clickCnt = 0;
import { Component, OnInit } from '@angular/core';
import { GoogleAnalyticsService } from '../google-analytics.service';
@Component({
template: '',
})
export class BasePageComponent implements OnInit {
constructor(protected $gaService: GoogleAnalyticsService) { }
import { Component, OnInit } from '@angular/core';
import { GoogleAnalyticsService } from '../google-analytics.service';
@Component({
selector: 'app-first-page',
templateUrl: './first-page.component.html',
styleUrls: ['./first-page.component.scss']
})
export class FirstPageComponent implements OnInit {
private _clickCnt = 0;
<button (click)="click()">Click Me!</button>
logEvent(event, category, label, value) {
gtag('event', event, {
event_category: category,
event_label: label,
value: value
});
console.log('gtag event captured...');
}
import { Component, OnInit } from '@angular/core';
import { GoogleAnalyticsService } from './google-analytics.service';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComponent implements OnInit {
title = 'Google Analytics Service';
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { GoogleAnalyticsService } from './google-analytics.service';
@NgModule({
declarations: [