Ever heard of netcat? It’s a small network utility to create TCP and UDP connections.
Simple file transfer over network:
# Run the server with:
$ nc -l 8000 > file_you_receive
GNU’s wget
is a command line tool to download files over HTTP(S) and FTP.
While curl
is great to send custom requests, it lacks a recursive mode to download all the resources linked to a page or domain.
This is where wget
is much useful.
1. Copy a whole site locally, including images, css, js and converting links:
$ wget -p -m -k fullweb.io
If you use gulp
as build tool for your web projects, you might have wondered how to pass custom flags to your tasks from CLI.
Well, with a lil’ help from the node package minimist, you can add this neat feature!
// gulpfile.js
var gulp = require('gulp');
var options = require('minimist')(process.argv);
See how to use git archive
to export your repository.
For instance to get a copy of the code at a given commit, tag or branch.
Note: it will not include the .git folder, just the code.
Create a Zip archive of the latest commit on the current branch:
$ git archive -o latest.zip HEAD
Make your web pages faster with Resource Hints <link>
tags! They are a great and simple way to tell the browser you need other resources for an optimal user experience.
The browser support is already pretty good to start using them today.
Pre-DNS resolve a domain:
<link rel="dns-prefetch" href="//widget.com">
Let’s see how to use PostgreSQL to import and export CSV files painlessly with the COPY
command.
Import CSV into table t_words
:
COPY t_words FROM '/path/to/file.csv' DELIMITER ',' CSV;
You can tell quote char with QUOTE
and change delimiter with DELIMITER
.
Let’s talk about jq
, the command line JSON processor.
jq
works the UNIX way, and can use it the same way you use sed
, grep
and the likes.
It is very flexible and supports a lot of options, be sure to check it’s documentation.
Here are 2 simple examples to give you an idea:
1. Piping JSON to jq
: