This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.querySelector("table") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
splash:runjs([[ | |
document.querySelector('table').innerHTML | |
]]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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. | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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. | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# [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}' | |
# { |
NewerOlder