Skip to content

Instantly share code, notes, and snippets.

@rmoyano
rmoyano / shellscripting.md
Created February 24, 2025 16:58
Shell scripting

Difference between "#!/usr/bin/env bash" and "#!/usr/bin/bash": Official Slackware book created by David Cantrell, Logan Johnson & Chris Lumens. Version 2.0 is a draft that is in development.

Because /usr/bin/env can interpret your $PATH, which makes scripts more portable.
#!/usr/bin/env bash #lends you some flexibility on different systems
Running a command through /usr/bin/env has the benefit of looking for whatever the default version of the program is in your current environment.

Will only run your script if python is installed in /usr/local/bin.

@rmoyano
rmoyano / linuxbooks.md
Last active February 21, 2025 19:25
Best GNU/Linux open free books
@rmoyano
rmoyano / apt.md
Last active February 13, 2025 15:38
APT

Installation

Assume yes to all prompts:

$ apt-get install ca-certificates curl -y

apt-get -y install One side effect of using -y is that it will skip downgrades, whereas if the user entered y, it would perform the downgrades. So if you want -y to execute the same thing as a user entering y,you also need to add --allow-downgrades

@rmoyano
rmoyano / docker.md
Created June 14, 2024 05:23
Docker notes

Docker notes

Entrypoint and CMD differences

One SO thread.

From Devopscube article:

In a Dockerfile, ENTRYPOINT and CMD are two different instructions that are used to define how a container should run.

ENTRYPOINT is used to specify the main command that should be executed when a container is started using the image. The default ENTRYPOINT command is /bin/sh -c.

Nmap cheatsheet

Tests

Basic test using Google IP:

user@notebook:~$ nmap 8.8.8.8
Starting Nmap 7.80 ( https://nmap.org ) at 2024-06-03 13:52 -03
Nmap scan report for dns.google (8.8.8.8)
Host is up (0.027s latency).
Not shown: 998 filtered ports
@rmoyano
rmoyano / curl.md
Last active June 13, 2024 19:17
Curl cheatsheet

CURL cheatsheet

Get the header response

user@notebook:~$ curl -I http://www.example.org
HTTP/1.1 200 OK
Accept-Ranges: bytes
Age: 126555
Cache-Control: max-age=604800
Content-Type: text/html; charset=UTF-8
@rmoyano
rmoyano / pipenv.md
Last active June 14, 2024 05:09
Pipenv cheatsheet

Pipenv cheatsheet

Installation

Install pipenv package and dependencies:

user@notebook:~/repos/pipenv$ pip install pipenv
Defaulting to user installation because normal site-packages is not writeable
Collecting pipenv
  Downloading pipenv-2023.12.1-py3-none-any.whl (3.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.1/3.1 MB 9.8 MB/s eta 0:00:00