Skip to content

Instantly share code, notes, and snippets.

View jeremy-rutman's full-sized avatar

jeremy rutman jeremy-rutman

View GitHub Profile
@jeremy-rutman
jeremy-rutman / pgpfix.sh
Last active November 30, 2023 17:43
google pgp fix (An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://dl.google.com/linux/chrome/deb stable InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY)
wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
@jeremy-rutman
jeremy-rutman / embed.cmd
Last active November 8, 2023 21:40
embed all fonts in pdf using gs
gs -dNOPAUSE -dBATCH -dNOPLATFONTS -sDEVICE=pdfwrite -dEmbedAllFonts=true -sOutputFile=out.pdf -f Wireless_Sensors_for_Assessment_of_Cardiac_Function_Final-BW2.pdf
@jeremy-rutman
jeremy-rutman / wifi_paswd_on_mac
Created May 14, 2022 21:34
wifi paswd on mac
security find-generic-password -ga "wifi_network_name" | grep "password:"
#crop bottom 10 pixels off all files that look like ffefd224-f72b-47e7-9671-c79fbebe25fd.jpg
# ie 8 digits hex, dash, 4 digits ....jpg
for f in $(ls|grep -E '^([a-f0-9]){8}\-([a-f0-9]){4}.*.jpg'); do echo $f; convert $f -gravity south -chop 0x10 $f;done
# grep -E is extended regex which requires less slashes iiuc, () around capture group you want to appear {n} times, . matches anyting
@jeremy-rutman
jeremy-rutman / useful_cli
Last active November 13, 2021 03:12
useful command line stuff
rdfind -deleteduplicates true . # delete duplicates with criteria for what to keep
file * # info on files e.g. image sizes
exec # get piped info and act on it
webhttrack # gui for web scrape
detox -r <folder> # remove spaces
find /tmp/ -depth -name "* *" -execdir rename 's/ /_/g' "{}" \; # remove filename spaces
to fix errs on apt-get update try removing old/broken/irrelevant files from /etc/apt/sources.list.d
@jeremy-rutman
jeremy-rutman / copy_files_recursive.sh
Last active March 19, 2022 13:43
get e.g. all .jpgs in a dir and subdirs, copy or delete them
# sed 's\.*/\\' cuts anything before the final forward slash , leaving filename without path
for f in $(find . -name '*.jpg'); do echo $f;echo $f|sed 's\.*/\\' ;cp $f $(echo $f|sed 's|.*/||'); done
#or e.g. only .jpgs larger than 10k and put in specific dir
for f in $(find /path/to/dirwithsubdirs/ -name '*mark.png' -size +10k ); do echo $f;echo $f|sed 's|.*/||' ;cp $f /path/to/destiny/data_logos/$(echo $f|sed 's\.*/\\'); done
#dont clobber extant files, by using cp --backup=numbered
for f in $(find /path/to/dir -name '*.jpg'); do cp --backup=numbered $f pics/$(echo $f|sed 's|.*/||'); done
@jeremy-rutman
jeremy-rutman / ensure_dir
Created October 26, 2021 03:28
python func to create missing dirs, recursively
import os
def ensure_dir(path):
'''
Create missing dirs recursively unless something coincides with file, or no permissions
:param path:desired path , to be created
:return:True if desired path created, False if not
'''
if not os.path.isdir(path):
print(path+' does not exist, creating')
sudo apt update
sudo apt install firefox python3-pip xvfb x11-utils --yes
sudo -H pip3 install bpython selenium
export DISPLAY=:2
Xvfb $DISPLAY -ac &
export GECKO_DRIVER_VERSION='v0.24.0'
wget https://github.com/mozilla/geckodriver/releases/download/$GECKO_DRIVER_VERSION/geckodriver-$GECKO_DRIVER_VERSION-linux64.tar.gz
tar -xvzf geckodriver-$GECKO_DRIVER_VERSION-linux64.tar.gz
#assumes selenium browser object
def get_img_and_further_info(browser,img_src):
try:
im = imageio.imread(img_src)
plt.plot(im)
plt.imshow()
# vv.imshow(im)
imageio.imwrite('test.jpg',im)
except Exception as e:
@jeremy-rutman
jeremy-rutman / LI_page_source_orig.html
Created March 26, 2021 14:37
Original LI page source
<!DOCTYPE html><html lang="en"><head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Sales Navigator</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
<style>
/* stylelint-disable */
.initial-load-animation {