Mosh Python Cheat Sheet



Download Free Pdf Beginners Python Cheat sheet for all Programmers 2021

  1. Python Cheat Sheet With Mosh
  2. Mosh Hamedani Python Cheat Sheet
  3. Python Cheat Sheets Pdf

When someone is trying out a set of exercises on a specific topic, or working on a project, cheatsheet can be really helpful. So programmer can fit so much information on just one sheet of paper, most fraudulent sheets are just a simple list of grammatical rules.

Vimdiff cheat sheet. ##git mergetool. In the middle file (future merged file), you can navigate between conflicts with c and c. Choose which version you want to keep with:diffget //2 or:diffget //3 (the //2 and //3 are unique identifiers for the target/master copy and the merge/branch copy file names). Download Free Pdf Beginners Python Cheat sheet for all Programmers. When someone is trying out a set of exercises on a specific topic, or working on a project, cheatsheet can be really helpful. So programmer can fit so much information on just one sheet of paper, most fraudulent sheets are just a simple list of grammatical rules. Python Cheat Sheet Mosh Hamedani Code with Mosh (codewithmosh.com) 1st Edition. About this Cheat Sheet. About this Cheat Sheet. If you’re serious about learning Python and getting a job as a Python developer, I highly encourage you to enroll in my Complete Python Course.

The purpose of this set of deception sheets is to remind you of grammatical rules, but also to remind you of important concepts.

In this Pdf Book we have some important python cheat sheets topics

§SSH / Mosh

More SSH awesomeness on https://github.com/moul/awesome-ssh

§SSH or mosh into a host and attach or create a named tmux session

and with mosh

replaces SERVER with your SSH target hostname.

§Unsafe SSH or Mosh connection (temporary servers: CI)

with Mosh:

§Non-interactive SSH with password

§Networking

§Measure network performances and stability with iperf

Install:

  • Install on mac with brew install iperf
  • Install on Linux with sudo apt install iperf

TCP test:

  • Run on the server: iperf -s -p 6666
  • Run on the client: iperf -c ${SERVER} -p 6666
Cheat

UDP test:

  • Run on the server: iperf -s -p 6666 -u
  • Run on the client: iperf -c ${SERVER} -p 6666 -u -b 900m
Python

§traceroute & ping with mytraceroute (mtr)

  • Install on Linux: sudo apt install mtr
  • Usage: mtr ${IP}

Example:

§Find big files & Cleanup space

§Get aggregated sizes of sub-dirs and files

§Find big files

§Cleanup docker

§Git / GitHub

§Git / GitHub essential tools

  • Install “hub” (https://hub.github.com/)
  • Install “refined GitHub” browser extension (https://github.com/sindresorhus/refined-github)

§Do rebase instead of merge when pulling

Cheat

git config --global pull.rebase true

Python Cheat Sheet With Mosh

§GitHub links

Update the following variables when appropriate:

  • USER a GitHub user or organization, i.e.: moul

  • Pull-Requests

    • In any repo of an user/organization: https://github.com/pulls?utf8=%E2%9C%93&q=is%3Aopen+is%3Apr+archived%3Afalse+user%3AUSER
    • Opened by an user: https://github.com/pulls?utf8=%E2%9C%93&q=is%3Aopen+is%3Apr+archived%3Afalse+author%3AUSER
    • Assignee to an user: https://github.com/pulls?utf8=%E2%9C%93&q=is%3Aopen+is%3Apr+archived%3Afalse+assignee%3AUSER
    • Mentioning an user/a team: https://github.com/pulls?utf8=%E2%9C%93&q=is%3Aopen+is%3Apr+archived%3Afalse+mentions%3AUSER
    • Requesting review from an user/a team: https://github.com/pulls?utf8=%E2%9C%93&q=is%3Aopen+is%3Apr+archived%3Afalse+review-requested%3AUSER

§Close a pull request from command line with “hub”

  1. Install “hub”
  2. Type hub api -X PATCH /repos/$USER/$REPO/pulls/$ID -F state=closed

§List projects in JSON

  • Fetch: hub api --paginate user/repos | jq . > github.json
  • Only “moul’s” projects: cat github.json | jq '.[] | select(.owner.login 'moul') > moul.json
  • Remove some fields to have a smaller .json file: cat moul.json | jq 'with_entries(select(.key|test('_url')|not)) | del(.owner) | del(.permissions) | del(.url) | del(.node_id)'

Or inline

§Bonus: find and close a pull-request named “Enabled GuardRails” in the current repository

§Manipulate JSON

§Flatten concatenated JSON files

Sometimes, when you run a command like this: hub api --paginate user/repos, you get multiple JSON outputs in the same file.

Python programming cheat sheet pdf

jq doesn’t care and you can run any jq command over the aggregated file, however, this .json file won’t be supported by most of the other softwares.

You can “repair” by flattening a concatenated JSON file by doing the following:

cat aggregate.json | sed 's/^]$$/],/;$$s/],/]]/;1s/^/[/' | jq '. | add'

Python programming cheat sheet pdf

The sed ... command will transfer the standalones arrays into a a valid array of arrays.

The jq . | add will flatten the array of arrays into a big 1 dimension array.

§Apply change on multiple files

§Replace a string by another in a whole Git repository

I’m using my https://github.com/moul/golang-repo-template project as repo template on GitHub.

The first task I need to do immediately after creating the new repo, is to replace every instance of golang-repo-template in the codebase by lorem-ipsum (the project name).

§Terminator on Windows

  • Install VcXsrv.exe on Windows and configure it to start automatically with the system
  • Create a startTerminator.sh file with the following content: cd; export DISPLAY=:0; nohup terminator &; sleep 1 and change the permissions chmod +x startTerminator.sh
  • Create a shortcut C:WindowsSystem32bash.exe {12345678-1234-5678-0123-456789abcdef} /home/moul/startTerminator.sh

§Web

§Temporary static web server

And then open your browser on http://localhost:8000

§Generate directory listing

§Proxy to avoid caching

§Socat

§Connect to a TTY over TCP

§TCP to UDP proxy

This TCP proxy can be forwarded over SSH to have access to an UDP port from localhost from a remote host

§Media manipulation

§Loop a video with ffmpeg

Mosh Hamedani Python Cheat Sheet

  1. calculate the amount of loops needed using https://dan.hersam.com/tools/time-calc.html
  2. for i in {1..383}; do printf 'file '%s'n' 'loop1.mp4' >> list.txt; done
  3. ffmpeg -f concat -i list.txt -c copy output.mp4

See this status

§Download YouTube video cover image

Python Cheat Sheets Pdf

  • the image of one video: youtube-dl --write-thumbnail --skip-download https://www.youtube.com/watch?v=xxxxxxxx
  • the image of multiple videos: youtube-dl --write-thumbnail --skip-download -a urls.txt with one URL per line in urls.txt