Skip to content

Instantly share code, notes, and snippets.

p = Calc-MyPatience()
s = Get-YourBullshit()
if (p-s <= 0):
print('Take a Break')
-- OR --
import mySanity
import you
@johnvilsack
johnvilsack / goggle.txt
Last active July 27, 2022 22:21
Personal Goggle
! name: Vilsack Goggle
! description: remove social media, boost social content
! public: true
! author: John Vilsack
! avatar: #9244e0
$discard
$boost=1,site=reddit.com
$boost=1,site=www.reddit.com
$boost=1,site=old.reddit.com
@johnvilsack
johnvilsack / arch.yaml
Created May 26, 2022 20:39
My notes on learning Arch
# BTW, I use Arch
setfont ter-132n
Wifi (wlan0):
- iwctl
- station wlan0 connect <ssid>
- exit
- ping google.com
- pacman -Syy
- pacman -S reflector
- reflector --verbose -l 10 -f 5 -c US -p https --save /etc/pacman.d/mirrorlist
@johnvilsack
johnvilsack / Tattoo.ps1
Created May 13, 2022 19:56
Powershell Tattoo Idea (by Request)
$TIM = Get-CimInstance Win32_LogicalDisk -Filter "DeviceID='C:'" | Select-Object -ExpandProperty Size
$patience = Get-CimInstance Win32_LogicalDisk -Filter "DeviceID='C:'" | Select-Object -ExpandProperty FreeSpace
$stress = ($TIM - $patience)
if (($stress / $TIM)*100) -gt 50) {Write-Host "Take a Break"}
# 1. $TIM is the size of C:. It never changes, so it is a constant and in all caps
# 2. $patience is the FreeSpace left. It changes and is all lowercase because it is variable
# 3. $stress is the Used Space. This is the Total Disk minus whatever is free.
# 4. $stress divided by TIM then multiplied by 100 tells you a percentage of how much total stress you are dealing with
# 5. If the percentage of stress is greater than 50, write "Take a Break" to the window.
@johnvilsack
johnvilsack / js
Created March 10, 2022 19:04
Google-Apps-Script: getThreadsByLabel
function getThreadsByLabel(label) {
const threads = GmailApp.getUserLabelByName(label).getThreads();
var threadList = [];
for (i = 0; i < threads.length; i++) {
threadList.push(threads[i].getId());
}
delete threads;
return threadList;
@johnvilsack
johnvilsack / GAS-RowScoping
Created August 22, 2019 14:59
GAS- Full Row Scoping
// This script runs every time a cell is changed
function onEdit(e) {
var thisSheet = SpreadsheetApp.getActiveSheet();
var editedCell = e.range.getA1Notation();
var editedRow = e.range.getRow();
var editedCol = e.range.getColumn();
var editedA1Col = columnToLetter(editedCol);
// @@ DEBUG
thisSheet.getRange('I10').setValue(editedCell);
@johnvilsack
johnvilsack / GAS-setEvalRow.js
Created August 21, 2019 21:15
GAS- Set Eval Row
// This is the code to edit
function evalRow(thisSheet, editedRow) {
// EDIT THE COLUMNS HERE TO CHANGE WHICH ROWS ARE IN ARRAY
var watchedRange = "A"+editedRow+":E"+editedRow;
var rowArray = thisSheet.getRange(watchedRange);
var rowValues = rowArray.getValues();
// @@ DEBUG
@johnvilsack
johnvilsack / GAS-columnToLetter.js
Created August 21, 2019 21:10
GAS: Column to A1 and Back Again
// Fixes SMALL oversight of not being able to work with A1 notation
function columnToLetter(column)
{
var temp, letter = '';
while (column > 0)
{
temp = (column - 1) % 26;
letter = String.fromCharCode(temp + 65) + letter;
column = (column - temp - 1) / 26;
}
@johnvilsack
johnvilsack / gas-onedit.js
Created August 21, 2019 21:08
GAS: onEdit Instantiation
// This script runs every time a cell is changed
function onEdit(e) {
var thisSheet = SpreadsheetApp.getActiveSheet();
var editedCell = e.range.getA1Notation();
var editedRow = e.range.getRow();
var editedCol = e.range.getColumn();
var editedA1Col = columnToLetter(editedCol);
// @@ DEBUG
@johnvilsack
johnvilsack / index.js
Last active August 29, 2015 14:26
Standard Index for ActiveScan index.js
function onConnectivityChange(state) {
console.log("Connection is: " + state);
}
function onBarcodeScanned(data) {
console.log(data.barcode);
}
var app = {
initialize: function() {