Skip to content

Instantly share code, notes, and snippets.

@gartnera
gartnera / click_notification.scpt
Created April 21, 2024 20:52
applescript to activate/raise the first notifcation on macos sonoma
tell application "System Events"
-- this is a custom keyboard shortcut for command + control + left arrow (Mission Control -> Show Notification Center)
keystroke (ASCII character 28) using {control down, command down}
end tell
tell application "System Events"
set _first_notification to group 1 of UI element 1 of scroll area 1 of group 1 of window "Notification Center" of application process "NotificationCenter"
-- this activates the notification group
click _first_notification
-- this actually follows the notification
@gartnera
gartnera / clpeak
Last active December 17, 2022 06:36
7900XT Linux Benchmarks. AMD Ryzen 7 7700X CPU. 32GB RAM. Ubuntu 22.04 userspace.
root@rocm22:~/clpeak/build# ./clpeak -d 0
Platform: AMD Accelerated Parallel Processing
Device: gfx1100
Driver version : 3513.0 (HSA1.1,LC) (Linux x64)
Compute units : 42
Clock frequency : 3125 MHz
Global memory bandwidth (GBPS)
float : 615.87
// ==UserScript==
// @name Mute preroll ads on twitch
// @namespace http://agartner.com
// @version 0.3
// @author Alex Gartner
// @match https://www.twitch.tv/*
// ==/UserScript==
let interval;
let didMute = false;
/*
Make sure your csv has these headers:
description,dateAcquired,dateSold,salesPrice,cost
Convert csv to json.
Paste the following code into the console.
Run fillAll with the json as an argument.
*/
@gartnera
gartnera / cloudflare_ddns.sh
Last active November 11, 2017 22:10
A script to update a cloudflare DNS record with your current IP
#!/bin/bash
auth_email='YOUR_EMAIL'
auth_key='YOUR_API_KEY'
zone_id='YOUR_ZONE_ID'
#you must create the record before using this script
record_id='YOUR_RECORD_ID'
host_name='YOUR_HOST_NAME'
@gartnera
gartnera / deleteGarbage.js
Created May 18, 2017 04:10
Delete garbage posts from a facebook messenger conversation
const fs = require("fs");
const login = require("facebook-chat-api");
login({appState: JSON.parse(fs.readFileSync('appstate.json', 'utf8'))}, (err, api) => {
if(err) return console.error(err);
api.setOptions({selfListen: true});
api.listen((err, event) => {
if(err) return console.error(err);
// ==UserScript==
// @name vmware open console in new tab
// @namespace http://agartner.com
// @version 0.2
// @description opens vmrc console in new tab rather than window. also forces html5 console if html5 = true. forces external if externalConsle = true
// @match https://vcloud.ialab.us/cloud/org/*
// @copyright 2014-2017, Alex Gartner
// ==/UserScript==
unsafeWindow.openPopoutConsole = function(vmName, vmId, vAppName, vmDevicesAvailable, buttonLabels, miscLabels, confirmationLabels, isVmrc) {
@gartnera
gartnera / tcp-forward.service
Created January 14, 2017 21:32
systemd service to forward traffic from port 9000 to 9001. Useful for getting around NAT.
[Unit]
Description=Forward TCP from 9000 to 9001 (bidirectional)
After=network.target
[Service]
Type=simple
User=nobody
Group=nobody
ExecStart=/usr/bin/socat TCP-LISTEN:9000,reuseaddr,fork TCP-LISTEN:9001,reuseaddr
Restart=always
@gartnera
gartnera / maxfan.sh
Created September 5, 2016 22:00
Script to max the fan speed for all amdgpu devices
#!/bin/bash
cd /sys/class/hwmon
for dir in $(ls); do
cd $dir
if [[ $(cat name) = "amdgpu" ]]; then
echo 1 > pwm1_enable
cat pwm1_max > pwm1
fi
cd ..
#!/usr/bin/env python2
import sys
import os
import tempfile
import shutil
import hashlib
import time
import re
import argparse