Skip to content

Instantly share code, notes, and snippets.

View Rajinsharwar's full-sized avatar
🥹

Rajin Sharwar Rajinsharwar

🥹
View GitHub Profile
@jordymeow
jordymeow / sse.php
Created May 27, 2023 01:28
SSE (Server-Sent Events) with PHP and JS / Streaming with PHP
<?php
// Various links
// https://serverfault.com/questions/488767/how-do-i-enable-php-s-flush-with-nginxphp-fpm
// https://stackoverflow.com/questions/72394213/nginx-configuration-for-server-sent-event
// https://serverfault.com/questions/801628/for-server-sent-events-sse-what-nginx-proxy-configuration-is-appropriate
// https://qiita.com/okumurakengo/items/cbe6b3717b95944083a1 (in Japanese)
// If '?SSE' is set, send Server-Sent events, otherwise we'll display the page.
if ( isset( $_GET['SSE'] ) ) {
@adamgen
adamgen / timedatectl list-timezones
Created April 10, 2017 09:36
An online display timedatectl list-timezones list
Africa/Abidjan
Africa/Accra
Africa/Addis_Ababa
Africa/Algiers
Africa/Asmara
Africa/Bamako
Africa/Bangui
Africa/Banjul
Africa/Bissau
Africa/Blantyre
@supercleanse
supercleanse / email_template.php
Created August 19, 2015 19:57
The default email template for MemberPress
<html style="font: 13px "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif; padding: 20px; position: relative; text-align: center; background-color: #efefef;">
<head>
<meta http-equiv="Content-Type" content="text/html;UTF-8" />
</head>
<body style="background-color: #efefef;">
<div id="header-pad" style="width: 680px; height: 5px; padding 0; margin: 0 auto; text-align: left;">
</div>
<?php echo $body; ?>
<div id="footer-pad" style="width: 680px; height: 50px; padding 0; margin: 0 auto; text-align: left;">
</div>
@saleemkce
saleemkce / download_file.php
Created January 24, 2014 18:30
PHP File Download Script - Download large file in chunks.
<?php
/*ini settings*/
set_time_limit(0);
ini_set('memory_limit', '512M');
//DOWNLOAD SCRIPT
$filePath = "G:/Software/versions/..PATH TO DOWNLOAD FILE...zip"; // set your download file path here.
download($filePath); // calls download function
function download($filePath)
{
@tschoffelen
tschoffelen / install.php
Last active February 12, 2024 09:20
A simple PHP script that automatically downloads and unzips the latest version of Wordpress in the current directory (./), so that I don't have to download it and upload it to my server through FTP manually.
<?php
echo '<pre>';
echo '<span style="color:blue">DOWNLOADING...</span>'.PHP_EOL;
// Download file
file_put_contents('wp.zip', file_get_contents('https://wordpress.org/latest.zip'));
$zip = new ZipArchive();
$res = $zip->open('wp.zip');
if ($res === TRUE) {