Skip to content

Instantly share code, notes, and snippets.

View bafflingscience's full-sized avatar

Baffling Science bafflingscience

View GitHub Profile
@bafflingscience
bafflingscience / iterm2.md
Created October 13, 2020 20:41 — forked from dineshkumar181094/iterm2.md
iterm2 cheatsheet

Tabs and Windows

Function Shortcut
New Tab + T
Close Tab or Window + W (same as many mac apps)
Go to Tab + Number Key (ie: ⌘2 is 2nd tab)
Go to Split Pane by Direction + Option + Arrow Key
Cycle iTerm Windows + backtick (true of all mac apps and works with desktops/mission control)
@bafflingscience
bafflingscience / yttDaily
Last active April 7, 2020 20:41
`yttDaily` downloads up to 10 items from each channel listed in the --batch-file, ignoring any previously downloaded videos listed in --download-archive, and adding newly downloaded videos to the --download-archive file.
#!/bin/bash
/Library/Frameworks/Python.framework/Versions/3.8/bin/youtube-dl \
--verbose \
--playlist-items 1-10 \
--download-archive /Users/userman/Archive/downloaded.txt \
--reject-title "^[Tt]op*[0-9]*" \
--add-metadata \
--embed-thumbnail \
--embed-subs \
--sub-lang en \
@bafflingscience
bafflingscience / commands.md
Created March 8, 2020 20:08
Fundamental Terminal and Vim Commands

Important Commands and Concepts

Commands

  • list your system architecture uname -m

    x86_64

  • append text and add new line to a file echo "text to append' >> ~/Path/to/file_name.txt

@bafflingscience
bafflingscience / wget.sh
Created March 7, 2020 19:47 — forked from crittermike/wget.sh
Download an entire website with wget, along with assets.
# One liner
wget --recursive --page-requisites --adjust-extension --span-hosts --convert-links --restrict-file-names=windows --domains yoursite.com --no-parent yoursite.com
# Explained
wget \
--recursive \ # Download the whole site.
--page-requisites \ # Get all assets/elements (CSS/JS/images).
--adjust-extension \ # Save files with .html on the end.
--span-hosts \ # Include necessary assets from offsite as well.
--convert-links \ # Update links to still work in the static version.
@bafflingscience
bafflingscience / ytpl
Last active April 7, 2020 20:07
youtube-dl - download playlist, output to existing directory, create directory, output files to new directory, index playlist videos.
#! /bin/bash
ytdl() {
/usr/local/bin/youtube-dl \
--verbose \
--playlist-start 1 \
--download-archive /Users/user/Archive/playlist_archive.txt \
--add-metadata \
--embed-thumbnail \
--write-description \
--xattrs \
@bafflingscience
bafflingscience / ytt.sh
Created March 7, 2020 19:29
youtube-dl script - alias cmd, save to selected directory in specified format
#! /bin/bash
ytdl() {
cd /Volumes/path/to/saveVideo; /usr/local/bin/youtube-dl -f "mp4" $1
}
ytdl $1
@bafflingscience
bafflingscience / TerminalViewHardware.md
Created November 8, 2019 03:21
Terminal commands to view hardware details on a Debian Linux operating system.

Quickly View Memory Details to upgrade RAM

Use lshw to View a Graphical Interface with of your System's Components

sudo lshw -X

For a less detailed view, just skip the sudo

# List unique values in a DataFrame column
# h/t @makmanalp for the updated syntax!
df['Column Name'].unique()
# Convert Series datatype to numeric (will error if column has non-numeric values)
# h/t @makmanalp
pd.to_numeric(df['Column Name'])
# Convert Series datatype to numeric, changing non-numeric values to NaN
# h/t @makmanalp for the updated syntax!