View timeperiodwithstepping
<?php | |
printf("<pre>\n"); | |
$secStep = 5; | |
$a = strtotime("2020-09-24 07:04:35 UTC"); | |
$b = strtotime("2020-09-24 07:05:50 UTC"); | |
var_dump($a); | |
var_dump($b); |
View test-spurious-arguments.php
<?php | |
declare(strict_types=1); | |
//see results: | |
//using declare(strict_types=1): https://3v4l.org/XJYlJ | |
//commented out declare(strict_types=1): https://3v4l.org/1bD85 | |
class Fruit { | |
// Properties | |
private string $name; |
View carbon-test-tz-conversion.php
<?php | |
// date/time variables using CarbonImmutable: https://carbon.nesbot.com/docs/ | |
//set user time zone | |
$userTimeZone = 'Europe/London'; | |
//======================= UTC ============================================== | |
//now in UTC | |
//CarbonImmutable i.e. don't change the hour value when switching timezones | |
$nowUTC = CarbonImmutable::now('UTC'); | |
//$nowUTC = CarbonImmutable::parse('2020-05-31 23:12:58 UTC'); |
View logrotate_script_platform.sh
#!/usr/bin/env bash | |
set -e | |
SCRIPTDIR=$(dirname "$0") | |
SCRIPTREALPATH=$(realpath $(dirname "$0")) | |
#cd "$SCRIPTDIR" | |
#echo $SCRIPTREALPATH |
View install-magmi-m2.sh
#Where to install magmi (symlink to vendor/macopedia/magmi2/magmi folder) | |
MAGMIFOLDER="yourmagmifolder" | |
#find the version you want using: composer show --all macopedia/magmi2 | |
MAGMIVERSION="v200.7.26" | |
composer require macopedia/magmi2 $MAGMIVERSION | |
ln -s vendor/macopedia/magmi2/magmi $MAGMIFOLDER | |
ls -l $MAGMIFOLDER |
View ebay_siteid_sitename_globalid_map.php
<?php | |
// Just a basic concept/array of eBay Site ID, Global ID and Site Name | |
// https://developer.ebay.com/devzone/merchandising/docs/concepts/siteidtoglobalid.html | |
$ebay_array = [ | |
"siteid" => [ | |
"0", "2", "3", "15", "16", | |
"23", "71", "77", "100", "101", | |
"123", "146", "186", "193", "201", | |
"203", "205", "207", "210", "211", |
View joomla-reset-two-factor.php
<?php | |
/* This script disables Joomla!'s two factor authentication | |
* plugin and clears the otpKey and otep values for Super | |
* Users. It allows you to login when you aren't able to | |
* use Google authenticator for any reason. | |
* Usage: | |
* Place it in the Joomla! 3.x root dir (where configuration.php | |
* and index.php are) and run it. Then login and leave the |
View pyurl2file.py
#!/usr/bin/python | |
# Improve http://stackoverflow.com/a/22776/286994 | |
# (using .format() instead of % string formatting) | |
import sys | |
import urllib2 | |
file_name = url.split('/')[-1] | |
u = urllib2.urlopen(url) | |
f = open(file_name, 'wb') |
View ignore_fiemap_errors.patch
Origin: https://code.google.com/p/libarchive/issues/detail?id=238 | |
Description: Ignore FIEMAP errors on linux < 2.6.28 | |
(most launchpad build daemon servers use ubuntu hardy) | |
https://bugs.launchpad.net/bugs/942994 | |
Index: libarchive-3.0.3/libarchive/archive_read_disk_entry_from_file.c | |
=================================================================== | |
--- libarchive-3.0.3.orig/libarchive/archive_read_disk_entry_from_file.c 2012-03-15 23:48:52.000000000 +0100 | |
+++ libarchive-3.0.3/libarchive/archive_read_disk_entry_from_file.c 2012-03-15 23:49:00.000000000 +0100 | |
@@ -855,16 +855,9 @@ |
View 02_fix-infinite-loop.patch
Origin: https://code.google.com/p/libarchive/issues/detail?id=226 | |
Description: Fix issue 226 (infinite loop while using libgxps-utils). | |
The patch is from this merge (adopted to match 3.0.3 release): | |
https://github.com/libarchive/libarchive/commit/f7cd53ca1eda0d08fc3b3876ed474321b9f70ac7 | |
Index: libarchive-3.0.3/libarchive/archive_read_support_format_zip.c | |
=================================================================== | |
--- libarchive-3.0.3.orig/libarchive/archive_read_support_format_zip.c 2012-03-04 16:01:31.000000000 +0100 | |
+++ libarchive-3.0.3/libarchive/archive_read_support_format_zip.c 2012-03-04 16:08:52.000000000 +0100 | |
@@ -1093,7 +1093,7 @@ |
NewerOlder