Skip to content

Instantly share code, notes, and snippets.

@srikanthmanda
Last active November 1, 2020 09:10
Show Gist options
  • Save srikanthmanda/9ba83479cf88143bf479c822526abf5d to your computer and use it in GitHub Desktop.
Save srikanthmanda/9ba83479cf88143bf479c822526abf5d to your computer and use it in GitHub Desktop.
Infrequently Used Commands

Infrequently Used Commands

PowerShell

Print PowerShell environment variable

$env:<variable>

Python

Print PWD and change directory in Python

from os import chdir, getcwd
print(getcwd())
chdir('C:\media\youtube\peter_norvig-design_of_computer_programs')

Utilities

youtube-dl

Download YouTube playlist

youtube-dl --yes-playlist <URL> -o '%(playlist_title)s - %(playlist_index)s - %(title)s.%(ext)s' --playlist-start <no>

Splunk

Splunk - Access field of previous event

<base query>
| reverse
| streamstats current=false last(<required field>) as prev_event_field by <grouping field(s)>
| table _time, prev_event_field, ...

Remove reverse to access next event's field.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment