This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wmic baseboard get product,Manufacturer,version,serialnumber | |
wmic MemoryChip get BankLabel, Capacity, MemoryType, TypeDetail, Speed | |
wmic cpu get Name | |
wmic PATH Win32_videocontroller GET description |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Check if API request route contains a given segment | |
function route_contains($segment, $request) { | |
// Check if segment to check is array | |
if( ! is_array($segment) ) { | |
// If not create an array | |
$segment = array($segment); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Fire and forget | |
nohup ./shell.sh >/dev/null 2>&1 & | |
# Wait and suppress output | |
( ./shell.sh ) >/dev/null 2>&1 | |
# Wait and return output | |
./shell.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Class NRK_Subtitle_Downloader | |
* | |
* This is a simple PHP script to help download subtitle files from NRK TV. | |
* The subtitle files are in VTT-format which is supported by Plex. | |
* | |
* Usage: | |
* php nrk-subtitle-downloader.php URL1,URL2,URL3 folder_path NOR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE FUNCTION `LEVENSHTEIN_RATIO`( s1 text, s2 text ) RETURNS int(11) | |
DETERMINISTIC | |
BEGIN | |
DECLARE s1_len, s2_len, max_len INT; | |
SET s1_len = LENGTH(s1), s2_len = LENGTH(s2); | |
IF s1_len > s2_len THEN | |
SET max_len = s1_len; | |
ELSE | |
SET max_len = s2_len; | |
END IF; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Class Multisite_Post_Type_Index | |
* | |
* This class creates and index of all the different post types on each blog in a multisite. As of now WordPress does not have a feature to list post types by blog, and hence this hacky but working solution.* | |
*/ | |
class Multisite_Post_Type_Index { | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// composer require jeremykendall/php-domain-parser | |
require_once __DIR__ . '/vendor/autoload.php'; | |
$manager = new Pdp\Manager(new Pdp\Cache(), new Pdp\CurlHttpClient()); | |
$domain = $manager->getRules()->resolve('this.is.a.very.long.domain.co.uk'); | |
var_dump($domain->getRegistrableDomain()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Extract the width and height from the URL of a resized image file in Wordpress. | |
* | |
* @param $url | |
* | |
* @return array|bool | |
*/ | |
function exctract_wordpress_image_size_from_url($url) { | |
preg_match('/-(?P<width>[0-9]+)x(?P<height>[0-9]+).(.+)$/', $url, $matches); | |
if ( array_key_exists('width', $matches) && array_key_exists('width', $matches) ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Template Name: Image test | |
* | |
* Requires PHP version 7 >=. | |
* | |
* Available GET parameters: | |
* | |
* ?posts_per_page=5 | |
* ?order=ASC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Example usage: | |
// The payload of the job | |
$userQueueItem = [ | |
'id' => 5, | |
'username' => 'user', | |
'email' => 'user@mail.com', |
OlderNewer