Skip to content

Instantly share code, notes, and snippets.

@jab416171
jab416171 / notes.md
Created April 26, 2025 17:22
Prosperous Universe Apps Script vs IMPORTDATA

If you're new to sheets/prun or just unfamiliar with apps script, a lot of you are probably just using something like =IMPORTDATA("https://rest.fnar.net/csv/prices") As you may have noticed, sometimes this can error out and cause your sheet to be broken. I'd like to tell you there's another option. You can use google apps script with a timer to query the same exact data, but only update the sheet if it was successful.

To get to apps script, open a spreadsheet and then go to Extensions then Apps Script. if you've never used it before on this sheet, you'll be greeted with an empty function. You can simply replace the entire file with the prunscript.js file.

In the script, I have commented out the burn and inventory endpoints. If you want to use these, you'll need to uncomment them and:

  1. Create an appropriate sheet and name it
  2. Update the name on lines 27 and 33
  3. Update your API key and username on lines 24 and 30
#!/usr/bin/env python
# This script will get the watched items from the mpv history and generate a playlist file with the unwatched items
# Depends on https://git.smrk.net/mpv-scripts/file/history.lua.html with a slight modification (add percent_pos to the table):
#
# --- history.lua.orig 2025-01-06 01:46:18.487447992 -0700
# +++ history.lua 2025-01-06 10:07:52.193541868 -0700
# @@ -25,12 +25,13 @@
# local sql = [=[

Keybase proof

I hereby claim:

  • I am jab416171 on github.
  • I am jab416171 (https://keybase.io/jab416171) on keybase.
  • I have a public key ASCFIZ4hqII3ZUQ2qafX6QyHYw4BocOGTXfrC3yHC46X2Qo

To claim this, I am signing this object:

#!/usr/bin/env python
import gspread
import sys
import json
from oauth2client.service_account import ServiceAccountCredentials
timestamp = sys.argv[1]
ping = sys.argv[2]
up = sys.argv[3]
down = sys.argv[4]
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
options=600003<RXCSUM,TXCSUM,RXCSUM_IPV6,TXCSUM_IPV6>
inet6 ::1 prefixlen 128
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1
inet 127.0.0.1 netmask 0xff000000
nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
epair3b: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=8<VLAN_MTU>
ether 02:54:89:xx:xx:xx
inet 0.0.0.0 netmask 0xff000000 broadcast 255.255.255.255
#!/usr/bin/env python
import sys
filename = sys.argv[1]
token = sys.argv[2]
def set_contains(set, token):
for item in set:
if token in item:
#! /bin/sh
for i in $(sysctl -n kern.disks | awk '{for (i=NF; i!=0 ; i--) if (match($i, '/da/')) print $i }')
do
echo $i `smartctl -a /dev/$i | awk '/Temperature_Celsius/{DevTemp=$10;} /Serial Number:/{DevSerNum=$3}; /Device Model:/{DevName=$3} END { print DevTemp,DevSerNum,DevName }'`
done
#!/usr/bin/env python
import gspread
import sys
import json
from oauth2client.client import SignedJwtAssertionCredentials
timestamp = sys.argv[1]
ping = sys.argv[2]
up = sys.argv[3]
down = sys.argv[4]
def insert_row(self, values, index=1):
""""Adds a row to the worksheet at the specified index and populates it with values.
Widens the worksheet if there are more values than columns.
:param values: List of values for the new row.
"""
self.add_rows(1)
data_width = len(values)
if self.col_count < data_width:
self.resize(cols=data_width)
#!/usr/bin/perl
sub foo(f)
a,b == 1,1
for i in range(f-1):
a,b = b,a+b
return str(a)
def bar(f:
if f=1 or f=2: