View html_table_to_csv.js
This file contains 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
// selects all table rows element in an HTML document ("tr"). | |
$$("tr").map( | |
// for each row, select each table data element ("td"). | |
(row) => Array.from( | |
row.querySelectorAll("td") | |
// for each data element return the inner text surrounded by quotes and stripped of line breaks. | |
).map( | |
(cell) => "'" + cell.innerText.replace("\n", " ") + "'" | |
// join same row elements with "," | |
).join(", ") |
View soss-mixture.jl
This file contains 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 Pluto.jl notebook ### | |
# v0.15.1 | |
using Markdown | |
using InteractiveUtils | |
# ╔═╡ 6ca58e9a-0707-11ec-1a6c-bdb652993535 | |
begin | |
using Plots | |
using StatsPlots |
View missing_deps.sh
This file contains 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
find /usr/local/agens/bin -type f -perm /a+x -exec ldd {} \; | grep ‘not found’ |
View svg2icns
This file contains 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
#!/bin/bash | |
echo "*** SVG 2 ICNS ***" | |
if [ $# -ne 1 ]; then | |
echo "Usage: svg2icns filename.svg" | |
exit 100 | |
fi | |
filename="$1" | |
name=${filename%.*} | |
ext=${filename##*.} | |
echo "processing: $name" |
View rm_quarantine_attr.sh
This file contains 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
xattr -d com.apple.quarantine my_jar.jar |
View list_dependency_graphs_sed.sh
This file contains 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
# sometimes we have a hierarchical list and we want to print all of the nodes | |
# that have a certain child, simple regular expression will only yield the child | |
# not the whole node. We can use sed to recover the whole node. | |
# | |
# let's say we want to recover all packages in pipenv graph that use pandas. | |
# /^ /!x{...} | |
# all of lines which do not start with a space are at the top of the | |
# hierarchy, swap them with the hold space. The hold space has now the node | |
# and the pattern space contains the contents of the hold space. Execute all | |
# commands between brackets. |
View remove_duplicate_lines_sed.sh
This file contains 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
# from https://www.linuxquestions.org/questions/programming-9/removing-duplicate-lines-with-sed-276169/ | |
# $!N | |
# if not in the last line, append the next line of input | |
# pattern space (no duplicates): line1\nline2 | |
# stdout: null | |
# | |
# /^\(.*\)\n\1$/ | |
# does the pattern space (eg. line1\nline2) contains duplicate lines (eg. line1 == line2)? | |
# | |
# /<REGEX>/!P |
View change_multiple_files.vim
This file contains 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
set aw | |
" There are two different approaches for finding the target files | |
" execute "args" join(systemlist("ag -l pattern path/to/files"), " ") | |
args `ag -l pattern path/to/files` | |
argdo %s/pattern/new/g | w |
View average_tables_in_the_wild.js
This file contains 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
// Before proceeding add an ID `target` to the table you want to perform the analysis on | |
// Google Chrome intercepts $ as a shortcut for document.querySelector() and | |
// $$() as a shortcut for document.querySelectorAll() | |
items = [] | |
$$('#target tr').forEach( | |
(row) => items.push( | |
parseFloat( |
NewerOlder