Skip to content

Instantly share code, notes, and snippets.

@Rudde
Rudde / pcp.sh
Created April 28, 2016 15:52
Bash copy tool giving speed and progress bar, working for files and directories built of pv
#!/bin/bash
hash pv
if [ $? -ne 0 ]; then
echo "ERROR: Command pv is not available but required, please run: sudo apt-get install pv"
exit 1
fi
WORKDIR=$(pwd)
@Rudde
Rudde / firstDayofFirstWeekinCurrentMonth.php
Last active April 8, 2016 16:11
Gives first day of the first week of the current month
<?php
/**
* Created by PhpStorm.
* User: Rudde
* Date: 01.04.2016
* Time: 00.25
*/
function firstDayofFirstWeekinCurrentMonth($date = NULL) {
$date = is_null ($date) ? new DateTime('first day of this month') : $date->modify('first day of this month');