Skip to content

Instantly share code, notes, and snippets.

View ctsstc's full-sized avatar
🔥
me = new Person(new Year(2019+5));

Cody Swartz ctsstc

🔥
me = new Person(new Year(2019+5));
View GitHub Profile
@ctsstc
ctsstc / ! Update Qbittorrent Forward Port from PIA.md
Last active March 10, 2024 02:33
Update Qbittorrent port on PIA network connection and port forward port

Update Qbittorrent Forward Port from PIA

This script updates the qbittorrent port from the port that PIA returns from its port forwarding if one is available.

This currently only does something if qbittorrent is open and running since it updates through the Web UI. There is commented code that could be changed to utilize the qbittorrent cli to change the port when the application is closed.

Preresiquites

This requires that you have qbittorrent's web interface enabled with the "Bypass authentication for clients on localhost" enabled.

@ctsstc
ctsstc / ! Windows Task Scheduler.md
Last active April 20, 2023 07:49
Save Windows Login Backgrounds on Login / Workstation Unlock

Automatically Save Windows Login Backgrounds on Login

This will add a sheduled task to run the powershell script on login/workstation unlock without displaying a window.

Note: you can also try importing the XML file below for the task 🤞

General Tab

  1. Open Task Scheduler
  2. Create Task under Task Scheduler Library
  3. Under Security Options:
    • Run whether user is logged on or not
@ctsstc
ctsstc / tabs-outliner-remove-crashed.js
Created September 15, 2021 10:20
Tabs Outliner - Remove Crashed
treeView.treeModel.currentSession_rootNode.subnodes
.filter(x => 'crashDetectedDate' in x.chromeWindowObj)
.forEach(x => x.hoveringMenuActions.deleteAction.performAction(x))
@ctsstc
ctsstc / copy-meds-from-mychart.js
Created July 21, 2021 21:22
Copy Medication List from MyChart to CSV
// Goto the medications page in mychart
// Then click through any additional tabs for different offices/locations at the top to load them up
// Run this in the console
// Open notepad paste and save as a .csv
// Note using "let" so that you can copy/paste multiple times w/o refreshing
let headers = [...document.querySelectorAll('.card.medcard[data-med-id]')];
let cleanup = (el) => el?.innerText.split(/\r\n|\r|\n|\,/).join(' ');
@ctsstc
ctsstc / safeway-just-for-u-clicker.js
Last active November 3, 2022 07:56
Safeway Just for U Auto Clicker. Add all the discounts at once.
// Allow redefinition for copy/paste
let Clicker = class {
#document;
#selector;
constructor(document, selector) {
this.#document = document;
this.#selector = selector;
}
@ctsstc
ctsstc / jsconfig.json
Created March 15, 2020 20:52
Javascript: Fix @ import for Vue and others
{
"compilerOptions": {
"baseUrl": "./",
"paths": {
"@/*": ["src/*"]
}
}
}

Keybase proof

I hereby claim:

  • I am ctsstc on github.
  • I am cts_ae (https://keybase.io/cts_ae) on keybase.
  • I have a public key ASDQOl_GG3phDr6YpOItUyepXklobgEzcpseci1Jr5YwFAo

To claim this, I am signing this object:

@ctsstc
ctsstc / Singletonizer.js
Created August 7, 2019 01:51
Only allow a singleton instance of a class, no matter who imports it.
const instances = {};
const Singletonizer = (Klass, ...args) => {
const className = Klass.constructor.name;
const created = instances.hasOwnProperty(className);
if (!created) {
new Klass(...args);
instances[className] = true;
}
}
@ctsstc
ctsstc / kube_commands.rb
Last active October 17, 2019 22:25 — forked from levibrown/kube_commands.rb
A CLI for Common G5 Kube Commands
#!/usr/bin/env ruby
# Setup:
# 1) `gem install highline`
# 2) save this file to a local folder
# 3) rename the file to remove extension `mv kube_commands.rb kube_command`
# 4) change permissions `chmod 755 kube_commands`
# 5) link to your /usr/local/bin `ln -s $PWD/kube_command /usr/local/bin/`
# 6) in a new shell you should now be able to run `kube_commands`
# 7) add new commands and add to this gist
@ctsstc
ctsstc / solid-dataLayer.js
Last active January 23, 2019 23:30
Prevent GTM dataLayer from being redeclared or redefined / overwritten.
(function(win) {
var privateDataLayer = win.dataLayer || [];
Object.defineProperty(window, 'dataLayer', {
get: function() {
return privateDataLayer;
},
set: function(value) {
// Prevent looping when dataLayer has already been defined ie: dataLayer = dataLayer || []
if (value instanceof Array && value !== privateDataLayer) {