Skip to content

Instantly share code, notes, and snippets.

View hansint.php
<?php
$raw=<<<'RAW'
TEN = 10;
HUNDRED = 100;
THOUSAND = 1000;
MILLION = 1000000;
BILLION = 1000000000;
TRILLION = 1000000000000;
QUADRILLION = 1000000000000000;
View ffmpeg video recorder steps recorder converter.php
<?php
declare(strict_types=1);
init();
function record():array{
$autoit=new AutoIt();
$stdin=fopen("php://stdin","rb");
stream_set_blocking($stdin,false);
$image_binaries=[];
$filename="recorded".bin2hex(random_bytes(4)).".png";
View gist:34d3f26cebaa5dcfd51a897bd546710b
No it's not valid ISO8601
> ISO8601 has multiple valid representations
that is true, for example
Basic format: YYYYMMDD Example: 19850412
Extended format: YYYY-MM-DD Example: 1985-04-12
View stupid date shit.php
<?php
// Øns 01-Apr-2020
$start=new DateTime("2020-08-01");
$start->modify("-1 day");
$end=new DateTime("2020-09-01");
for(;;){
$start->modify("+1 day");
if($start>=$end){
break;
}
@divinity76
divinity76 / curlopt_verbose.php
Last active Aug 1, 2020
curlopt verbose stackoverflow
View curlopt_verbose.php
add CURLOPT_VERBOSE: ```$stderrh=tmpfile();
curl_setopt_array($ch,array(CURLOPT_VERBOSE=>1,CURLOPT_STDERR=>$stderrh));
curl_exec($ch);
/* https://bugs.php.net/bug.php?id=76268 */
rewind($stderrh);
$stderr=stream_get_contents($stderrh);
fclose($stderrh);
echo $stderr;
``` and show the verbose log
View newline_fixer.php
<?php
declare(strict_types = 1);
function replaceRecursive(string $dir, array $replaces, array $ext_whitelist = [], array $ext_blacklist = [], array $name_blacklist = [], bool $onlytext = false): void
{
$dir = rtrim($dir, DIRECTORY_SEPARATOR);
$files = glob($dir . DIRECTORY_SEPARATOR . '*');
foreach ($files as $file) {
if (in_array(strtolower(basename($file)), $name_blacklist, true)) {
continue;
@divinity76
divinity76 / sql.sql
Created May 17, 2020
SQLite INET_ATON / ip2long / INET_NTOA / long2ip
View sql.sql
-- found here https://vcert.blogspot.com/2013/04/ip2long-and-long2ip-in-excel.html?showComment=1589707642294#c2711257816799880812
-- copyright unknown..
-- long2ip:
SELECT IPint, ((IPint >> 24) & 255) ||'.'||
((IPint >> 16) & 255) ||'.'|| ((IPint >> 8) & 255) ||'.'|| ((IPint ) & 255)
FROM iptest;
-- found here https://vcert.blogspot.com/2013/04/ip2long-and-long2ip-in-excel.html?showComment=1589707642294#c2711257816799880812
-- copyright unknown..
-- ip2long:
View searchAND.php
<?php
declare(strict_types = 1);
$search_needles = array();
$search_regex = array();
$start_dir = implode(DIRECTORY_SEPARATOR, [
__DIR__,
"..",
'easyad'
View crosshair.au3
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <Constants.au3>
#include <WinAPI.au3>
#include <WinAPISys.au3>
#include <WinAPIvkeysConstants.au3>
Func ExitFunc()
Exit(0);
EndFunc
HotKeySet("l","ExitFunc");llllllllllllll
@divinity76
divinity76 / duckduckgo.imagesearch.php
Created Apr 29, 2020
duckduckgo image search libcurl php
View duckduckgo.imagesearch.php
<?php
declare(strict_types=1);
$search_query="Nintendo 64 controller";
require_once('hhb_.inc.php');
$hc=new hhb_curl('',true);
$hc->setopt_array(array(
CURLOPT_CONNECTTIMEOUT=>10,
CURLOPT_TIMEOUT=>20,
// without a fake useragent, you will get the error: <div id="error_homepage" style="display:block">Oops, there was an error. &nbsp;Please try again.<br><br>If it persists, please email error@duckduckgo.com<br><img src="https://improving.duckduckgo.com/t/fpbot">