Skip to content

Instantly share code, notes, and snippets.

View nepsilon's full-sized avatar

James Pudson nepsilon

View GitHub Profile
@nepsilon
nepsilon / netcat-intro.md
Last active February 19, 2017 12:38
An intro to netcat — First published in fullweb.io issue #13

An intro to netcat

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
@nepsilon
nepsilon / 3-handy-wget-tips.md
Last active February 19, 2017 12:41
3 handy wget tips — First published in fullweb.io issue #14

3 handy Wget tips

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
@nepsilon
nepsilon / pass-custom-options-gulp-cli.md
Last active July 12, 2016 06:31
Pass custom options to gulp — First published in fullweb.io issue #15

How to pass custom options to gulp

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); 
@nepsilon
nepsilon / export-repo-git-archive-tips.md
Last active January 12, 2025 11:14
Export your repo with git archive — First published in fullweb.io issue #16

Export your repo with git archive

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 
@nepsilon
nepsilon / bash-zsh-useful-aliases.md
Last active December 25, 2021 08:20
Useful aliases for bash and zsh — First published in fullweb.io issue #17

Useful aliases for bash and zsh

Using aliases to give commands useful options by default is a good way to boost productivity.

Here are 5 aliases to put in your ~/.bashrc or ~/.zshrc to keep them permanently:

1. ls:

# ls: adding colors, verbose listign
# and humanize the file sizes:
@nepsilon
nepsilon / resource-hints.md
Last active November 18, 2019 07:09
Faster webpages with Resource Hints — First published in fullweb.io issue #18

Faster webpages with Resource Hints

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"> 
@nepsilon
nepsilon / postgres-import-export-csv.md
Last active July 29, 2024 01:26
Importing and Exporting CSV files with PostgreSQL — First published in fullweb.io issue #19

Importing and exporting CSV files with PostgreSQL

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.

@nepsilon
nepsilon / bash-remove-spaces-in-filename.md
Last active November 15, 2024 23:14
How to remove spaces in filenames and lowercasing — First published in fullweb.io issue #20

How to remove spaces in filename and lowercasing

A short script this week to replace spaces in filenames in a given folder:

# Looping over files, forging new filename, and then renaming it.
# Spaces will be replaced by underscores (_).
for oldname in * 
do 
 newname=`echo $oldname | sed -e 's/ /_/g'` 
@nepsilon
nepsilon / 5-git-tips.md
Last active February 19, 2017 12:45
5 tips to show (once again) that Git is amazing — First published in fullweb.io issue #21

5 tips to show (once again) that Git is amazing:

1. Fetch a file from another branch without changing your current branch:

$ git checkout other_branch -- path/to/file 

2. See what branches are merged:

$ git checkout master 
@nepsilon
nepsilon / cli-json-filtering-jq.md
Last active July 9, 2016 00:46
CLI JSON processor with jq — First published in fullweb.io issue #22

CLI JSON processor with jq

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: