├── code-of-conduct.md ├── contributing.md └── readme.md /code-of-conduct.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, gender identity and expression, level of experience, 9 | nationality, personal appearance, race, religion, or sexual identity and 10 | orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at . All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at [http://contributor-covenant.org/version/1/4][version] 72 | 73 | [homepage]: http://contributor-covenant.org 74 | [version]: http://contributor-covenant.org/version/1/4/ 75 | -------------------------------------------------------------------------------- /contributing.md: -------------------------------------------------------------------------------- 1 | # Contribution Guidelines 2 | 3 | Please note that this project is released with a 4 | [Contributor Code of Conduct](code-of-conduct.md). By participating in this 5 | project you agree to abide by its terms. 6 | 7 | --- 8 | 9 | Ensure your pull request adheres to the following guidelines: 10 | 11 | - Make sure you take care of this 12 | - And this as well 13 | - And don't forget to check this 14 | 15 | Thank you for your suggestions! 16 | 17 | 18 | ## Updating your PR 19 | 20 | A lot of times, making a PR adhere to the standards above can be difficult. 21 | If the maintainers notice anything that we'd like changed, we'll ask you to 22 | edit your PR before we merge it. There's no need to open a new PR, just edit 23 | the existing one. If you're not sure how to do that, 24 | [here is a guide](https://github.com/RichardLitt/knowledge/blob/master/github/amending-a-commit-guide.md) 25 | on the different ways you can update your PR so that we can merge it. 26 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # awesome-shell-commands [![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://github.com/sindresorhus/awesome) 2 | 3 | > A curated list of tasks done from the command line 4 | 5 | 6 | ## Contents 7 | 8 | - [Hardware specs](#hardware-specs) 9 | - [Media](#media) 10 | - [Misc](#misc) 11 | - [Networking](#networking) 12 | - [Operating system](#operating-system) 13 | - [Disk](#disk) 14 | - [Programmer](#programmer) 15 | - [Security](#security) 16 | 17 | 18 | ## Hardware specs 19 | 20 | Querying the OS to get hardware info. 21 | 22 | - Connected usb devices: `lsusb` 23 | - Details on a usb device: `lsusb -d vendorId:productId -v` 24 | - Get graphic controllers: `lspci | grep -i vga` 25 | - Get graphic controllers (detailed): `lshw -C video` 26 | 27 | ## Media 28 | 29 | From GIFs to movie editing. 30 | 31 | - Download video from youtube: `youtube-dl https://www.youtube.com/watch?v=tN12Tg5ttpk -f mp4` 32 | - Extract audio from video: `ffmpeg -i ytcracker\ -\ meganerd-tN12Tg5ttpk.mp4 meganerd.mp3` 33 | - Play mp3: `ffplay meganerd.mp3` `mplayer meganerd.mp3` 34 | 35 | ### File conversion 36 | 37 | - GIF to MP4 and viceversa: `ffmpeg -f gif -i infile.gif outfile.mp4` 38 | - OGV to MP4: `ffmpeg -i out.ogv -strict -2 out.mp4` 39 | - PNG to PDF: `convert grid.png -gravity center grid.pdf` 40 | - Make a GIF from a screencast: 41 | ```sh 42 | ffmpeg -i mem-01.ogv frames/ffout%03d.png 43 | convert -loop 0 frames/ffout* mem-01.gif 44 | convert mem-01.gif -fuzz 10% -layers Optimize optimized.gif 45 | ``` 46 | 47 | ### Image editing 48 | 49 | - Resize your 100MB smartphone picture: `convert IMG_2000.jpg -resize 1024x IMG_2000_resized.jpg` 50 | 51 | ### Video editing 52 | 53 | - Clip video (starting from second 3): `ffmpeg -i take-3.mp4 -ss 00:00:03 -t 00:02:04 output.mp4` 54 | - [Crop video](https://video.stackexchange.com/questions/4563/how-can-i-crop-a-video-with-ffmpeg#4571): `ffmpeg -i in.mp4 -filter:v "crop=out_w:out_h:x:y" out.mp4` 55 | - Speed video up: `ffmpeg -i take-4.mp4 -filter:v "setpts=0.5*PTS" take-4-faster.mp4` 56 | - Remove audio from video: `ffmpeg -i loud.mp4 -c copy -an muted.mp4` 57 | - Resize video: `ffmpeg -i larger.mp4 -filter:v scale=720:-1 -c:a copy smaller.mp4` 58 | - Pull video metadata: `exiftool take.mp4` 59 | - Timelapse a video: 60 | ```sh 61 | ffmpeg -i input.mp4 -r 1 -f image2 frames/%05d.png 62 | ffmpeg -i frames/%05d.png timelapse.mp4 63 | ``` 64 | 65 | ## Misc 66 | 67 | KEWL 68 | 69 | - Compress a directory: `tar -zcvf archive-name.tar.gz directory-name` 70 | - Zip a directory: `zip -r foo.zip foo/` 71 | - Delete old files: `rm $(ls -lh *csv | grep "Dec 18" | cut -d' ' -f11)` 72 | - Nyancat: `nc -v nyancat.dakko.us 23` 73 | - Record X11 action: `cnee --record -o automate-this.xnr --mouse --events-to-record 1000 --time 2` 74 | - Replay X11 action: `cnee --replay -f automate-this.xnr --time 2` 75 | - [Rotate the screen](https://askubuntu.com/questions/95812/how-can-i-rotate-my-display-in-the-most-easy-way): `xrandr --output HDMI-1 --rotate inverted` 76 | - Weather: `curl http://wttr.in/mexico-city` 77 | 78 | ## Networking 79 | 80 | Connect, scan, and ping the interwebz. 81 | 82 | - Connect to VPN: `nmcli con up id sub.kewlvpn.lol` 83 | - Check avail networks: `nmcli con` 84 | - Incognito browsing: `firefox --private-window` `chromium-browser --incognito` 85 | 86 | ## Operating system 87 | 88 | Querying info about the OS 89 | 90 | - Architecture: `uname -m` 91 | - Distro: `cat /etc/*release` 92 | - Distro name: `lsb_release -cs` 93 | - Find process running on a specific port: `ss -lptn 'sport = :3000'` 94 | - Most recent kernel messages: `dmesg | tail` 95 | - Packages installed (debian|ubuntu): `dpkg -l` 96 | - List all processes sorted by memory: `ps aux --sort -rss` 97 | - Specific package installed: `dpkg -l nvidia*` 98 | - Watch memory every 5 seconds: `watch -n 5 free -m` 99 | 100 | ### Disk 101 | 102 | - Mounted partitions (in human-friendly units): `df -h` 103 | - Summary of disk space used by directories: `du -hs *` 104 | - [List virtualbox disks](https://myshittycode.com/2013/11/23/virtualbox-failed-to-delete-the-storage-unit-of-the-hard-disk-pathhard-disk-vdi-cannot-close-medium-pathhard-disk-vdi-because-it-has-n-child-media/): `VBoxManage list hdds` 105 | - [Close a stuck virtual box disk so you can remove it](https://myshittycode.com/2013/11/23/virtualbox-failed-to-delete-the-storage-unit-of-the-hard-disk-pathhard-disk-vdi-cannot-close-medium-pathhard-disk-vdi-because-it-has-n-child-media/): `VBoxManage closemedium disk 633abeef-c3a0-43b0-b371-1238adeac4c` 106 | 107 | ## Programmer 108 | 109 | Optimizing workflow for the lazy programmer 110 | 111 | - Delete all node_modules recursively: `find . -name 'node_modules' -type d -prune -exec rm -rf '{}' +` 112 | - Delete all containers named like mongo: `docker rm $(docker ps -a | grep mongo | cut -f 1 -d' ')` 113 | - Stop all containers: `docker stop $(docker ps -a -q)` 114 | - Remove all containers: `docker rm $(docker ps -a -q)` 115 | - Remove all images: `docker rmi $(docker images -q)` 116 | - [Get latest git-commit id](https://stackoverflow.com/questions/19176359/how-to-get-the-last-commit-id-of-a-remote-repo-using-curl-like-command#19176626): `echo $(git log --format="%h" -n 1)` 117 | - Updating author in git history: 118 | ```sh 119 | git rebase -i -p 120 | git commit --amend --author="John Snow " 121 | ``` 122 | 123 | ## Security 124 | 125 | - Add password to PDF: `pdftk [mydoc].pdf output [mydoc.128].pdf owner_pw [foo] user_pw [baz]` 126 | - Symmetric encryption using GPG: `gpg -c filename` 127 | - Encrypt a zipfile: `zip --encrypt file.zip.enc file` 128 | 129 | ## Contribute 130 | 131 | Contributions welcome! Read the [contribution guidelines](contributing.md) first. 132 | 133 | 134 | ## License 135 | 136 | [![CC0](http://mirrors.creativecommons.org/presskit/buttons/88x31/svg/cc-zero.svg)](http://creativecommons.org/publicdomain/zero/1.0) 137 | 138 | To the extent possible under law, has waived all copyright and 139 | related or neighboring rights to this work. 140 | --------------------------------------------------------------------------------