Skip to content

Instantly share code, notes, and snippets.

@jikanter
jikanter / table-contents.js
Last active October 19, 2025 22:13
[Splash] Table Contents
document.querySelector("table")
@jikanter
jikanter / table-contents.lua
Created October 19, 2025 22:07
[Scraping Hub] Utilities
splash:runjs([[
document.querySelector('table').innerHTML
]])
@jikanter
jikanter / dbt_snippets.py
Last active January 15, 2025 19:01
[dbt snippets] #ai #aigenerated #chatgpt #
# List of Highly Used Pandas Data Transforms
# 1. Loading Data
import pandas as pd
data = pd.read_csv('data.csv')
# 2. Basic Inspection
data.info()
data.describe()
data.head()
@jikanter
jikanter / 0dedict.py
Created December 26, 2024 20:40 — forked from josephg/0dedict.py
Apple dictionaries
# Thanks to commenters for providing the base of this much nicer implementation!
# Save and run with $ python 0dedict.py
# You may need to hunt down the dictionary files yourself and change the awful path string below.
# This works for me on MacOS 10.14 Mohave
from struct import unpack
from zlib import decompress
import re
filename = '/System/Library/Assets/com_apple_MobileAsset_DictionaryServices_dictionaryOSX/9f5862030e8f00af171924ebbc23ebfd6e91af78.asset/AssetData/Oxford Dictionary of English.dictionary/Contents/Resources/Body.data'
f = open(filename, 'rb')
@jikanter
jikanter / 0dedict.py
Created December 26, 2024 20:40 — forked from jordankanter/0dedict.py
Apple dictionaries
# Thanks to commenters for providing the base of this much nicer implementation!
# Save and run with $ python 0dedict.py
# You may need to hunt down the dictionary files yourself and change the awful path string below.
# This works for me on MacOS 10.14 Mohave
from struct import unpack
from zlib import decompress
import re
filename = '/System/Library/Assets/com_apple_MobileAsset_DictionaryServices_dictionaryOSX/9f5862030e8f00af171924ebbc23ebfd6e91af78.asset/AssetData/Oxford Dictionary of English.dictionary/Contents/Resources/Body.data'
f = open(filename, 'rb')
@jikanter
jikanter / inspect-table.lua
Last active December 26, 2024 20:25
[Inspect Table] #hammerspoon #lua
-- A robust table inspection utility
function inspectTable(t, method)
if (method == "inspect") then
print(hs.inspect(t))
elseif (method == "keys") then
for k, v in pairs(t) do
print(k)
end
elseif (method == "metatable") then
if (t.__metatable ~= nil) then
@jikanter
jikanter / no-flicker.html
Created September 10, 2024 15:57
[Other way to do flicker hide - no JQuery]
<style id="flickersuppression">
/* Add CSS to elements you want to hide */
#carousel {visibility:hidden !important}
</style>
<script type="text/javascript">
/*
This function will poll the DOM for a specified amount of time until a specific element is available in the DOM and once available, execute a callback function which can be used to change the content on the page. The arguments are:
t: A function which returns the DOM element you are looking for.
e: The callback function to execute after the element exists.
@jikanter
jikanter / target-flicker-hide.html
Created September 10, 2024 15:00
[target flicker hide with jquery] #jquery #target #flicker
<style id="flickersuppression">
/* Add CSS to elements you want to hide */
#carousel {visibility:hidden !important}
</style>
<script type="text/javascript">
/*
The function below requires jQuery to be on the page, using the $ namespace.
Feel free to modify namespace if needed.
*/
@jikanter
jikanter / pythonexec.lua
Last active December 26, 2024 20:25
[Execute Python From Lua] #lua
function runPythonCode(scriptCode)
--local output, status, type, rc = hs.execute("PATH=/usr/local/bin:${PATH}; python -c 'import sys; sys.stdout.write(str(123))'")
local output, status, type, rc = hs.execute("PATH=/usr/local/bin:${PATH}; python -c '" .. scriptCode .. "'")
local response = {
output = output,
status = status,
type = type,
rc = rc
}
return response
@jikanter
jikanter / jq-insert-var.sh
Last active October 14, 2025 18:47
[Jq Recipes] Jq Recipes #javascript #json #jq
# [shr-800001]
# use the jq utility when a small transform to json is required is required in the shell.
# only use jq to transform the output of the json. Never use jq in the shell to process javascript or full programming
# languages.
# [shr-800002]
# To add and remove items to json via jq use the below console command
# in the example, the key "foo" is added to the initial object and set to the value "bar".
echo '{"hello": "world"}' | jq --arg foo bar '. + {foo: $foo}'
# {