Skip to content

Instantly share code, notes, and snippets.

View gvgvgvijayan's full-sized avatar

Vijayan gvgvgvijayan

View GitHub Profile
<?php
`libreoffice --headless --invisible --convert-to pdf sample.ppt --outdir ./out/ > /dev/null`;
@gvgvgvijayan
gvgvgvijayan / tombstone.php
Created August 11, 2019 14:27
Tombstone helper
<?php
namespace Helper\TombstoneHelper;
use Scheb\Tombstone\{
GraveyardProvider,
Handler\StreamHandler,
Tracing\TraceProvider
};
@gvgvgvijayan
gvgvgvijayan / tombstone_marker_sample.php
Created August 11, 2019 14:30
This gist show how we can detect the dead code in our codebase
<?php
require_once('vendor/autoload.php');
use Helper\TombstoneHelper\TombstoneHelper;
class DeadCode {
private $tombstoneHelper;
public function __construct() {
@gvgvgvijayan
gvgvgvijayan / tombstone.log
Created August 11, 2019 14:32
Log generated by tombstone
2019-08-11T18:37:51+05:30 - Vampire detected: tombstone("11-Aug-19", "Vijayan"), in file /var/www/html/tombstone/index.php:15, in function DeadCode->called, invoked by deadCodeTrigger
2019-08-11T19:41:47+05:30 - Vampire detected: tombstone("11-Aug-19", "Vijayan"), in file /var/www/html/tombstone/index.php:15, in function DeadCode->called, invoked by deadCodeTrigger
2019-08-11T19:44:20+05:30 - Vampire detected: tombstone("11-Aug-19", "Vijayan"), in file /var/www/html/tombstone/index.php:15, in function DeadCode->called, invoked by deadCodeTrigger
import requests
import openpyxl
import time
#CONSTANTS
API_URL = 'https://restcountries.eu/rest/v2/name/'
def extract_country_details(search_term):
@gvgvgvijayan
gvgvgvijayan / basic_image.php
Created December 22, 2019 05:03
This is used to create basic filled rectangle image using PHP
<?php
$handle = imagecreatetruecolor(640, 480); #create a 640px wide 480px height image. Consider this like canvas to draw.
$green = imagecolorallocate($handle, 0, 255, 0); #assign green color
imagefilledrectangle($handle, 0, 0, 640, 480, $green); #Create filled rectangle with green color. Consider like this the shape drawn over the canvas.
# Jpeg conversion
header("Content-type: image/jpg");
imagejpeg($handle);
<img src="http://localhost/image.php">
<?php
$wide = 1080;
$height = 50;
$handle = imagecreatetruecolor($wide, $height); #create a 640px wide 480px height image. Consider this like canvas to draw.
$green = imagecolorallocate($handle, 0, 255, 0); #assign green color
$black = imagecolorallocate($handle, 0, 0, 0); #assign black color
imagefilledrectangle($handle, 0, 0, $wide, $height, $green); #Create filled rectangle with green color. Consider like this the shape drawn over the canvas.
@gvgvgvijayan
gvgvgvijayan / .htaccess
Created December 22, 2019 14:23
masquerade config for php as image
RewriteEngine On
RewriteBase /
RewriteRule ^image\.jpg image.php [L,QSA]
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>