Multithreaded compression – pigz

Install pigz:

sudo apt install pigz

To compress a single directory recursively:

tar --use-compress-program="pigz -k " -cf output.tar.gz sourcedir

To compress each directory separately:

find . -maxdepth 1 -mindepth 1 -type d -exec tar --use-compress-program="pigz -k " -cf {}.tar.gz {} \;

CORS – test with curl

Send an OPTIONS message and check Access-Control-Allow-Origin is in the response:

curl -X OPTIONS 'https://domain/path/file.png' -H "Origin: http://yoursitedomain" -H "Access-Control-Request-Method: POST" -H "Access-Control-Request-Headers: X-Requested-With"  --verbose 

Or if you want to ignore the output:

curl -X OPTIONS 'https://domain/path/file.png' -H "Origin: https://yoursitedomain" -H "Access-Control-Request-Method: POST" -v -o /dev/null

Ubuntu etherneT not working

If is it not a driver problem, try the following:

  • sudo lshw -C network or ip a to find the interface
  • sudo ifconfig ethXXXX up
  • sudo dhclient -r
  • sudo dhclient

If it works, then you can persist the changes by editing the file: /etc/network/interfaces:

  1. auto ethXXXX
  2. iface ethXXXX inet dhcp

Spring vs Jax-RS annotations

SPRING ANNOTATIONJAX-RS ANNOTATION
@RequestMapping(path = “/troopers”@Path(“/troopers”)
@PostMapping@POST
@PutMapping@PUT
@GetMapping@GET
@DeleteMapping@DELETE
@ResponseBodyN/A
@RequestBodyN/A
@PathVariable(“id”)@PathParam(“id”)
@RequestParam(“xyz”)@QueryParam(‘xyz”)
@RequestParam(value=”xyz”)@FormParam(“xyz”)
@RequestMapping(produces = {“application/json”})@Produces(“application/json”)
@RequestMapping(consumes = {“application/json”})@Consumes(“application/json”)

Personal portal to the Internet