Skip to content

Instantly share code, notes, and snippets.

View adhocore's full-sized avatar
🎯
Focusing

Jitendra Adhikari adhocore

🎯
Focusing
View GitHub Profile
@george-hawkins
george-hawkins / wake-issue.md
Last active July 24, 2024 03:27
After installing Ubuntu 20.04 my machine frequently wakes from sleep for no obvious reason. This gist describes my attempts to resolve this.

Diagnosing spurious wakes

This gist documents my attempts to get to the bottom of spurious wakes after installing Ubuntu 20.04 LTS on my system.

Initially, I thought it might be another system on my network sending Wake-on-LAN (WoL) packets. Then I thought it might be a known XHCI spurious wake kernel issue. And lastly, I finally resolved things by actively disabling the ability of USB devices, e.g. the mouse, to wake the system.

Update: I later came up with a better way of disabling wake-on-mouse that's covered here.

Note: as one of these steps, I upgraded the system BIOS - while this didn't resolve this particular issue, it did resolve an annoying issue with the graphic state not being properly restored for certain applications after wake-up.

@kirmorozov
kirmorozov / Magento_2.2.2_PHP7.4_Preload_vs_PHP-7.3-results.md
Last active August 23, 2021 13:25
Magento PHP7.4 Preload vs PHP 7.3 results.md

Current Magento 2.2.2 PHP 7.4 with preload is 10%+ faster

Comparison of means

PHP 7.4 with preload is 11.07% faster then PHP 7.3

PHP 7.4 with preload is 13.25% faster then PHP 7.1

Sample 1 PHP 7.4 with Preload

Mean: 0.458

@jimmywarting
jimmywarting / readme.md
Last active July 27, 2024 17:49
Cors proxies
Exposed headers
Service SSL status Response Type Allowed methods Allowed headers
@adhocore
adhocore / expand_array.php
Last active December 19, 2019 04:05
A helper function expand_array for PHP
<?php
/**
* A helper function expand_array for PHP
*
* This is actually developed during the real need to develop JSON api
* I wanted to have JSON api response spitted properly expanded (with semantic nodes)
* But didnot want to do it by playing with arrays (looping, merging n' what not) time and again.
* So, After fetching single dimensional array data from database, with keys having
* some specific delimeter, this helper would do for me what i want to.
@mattneary
mattneary / examples.php
Last active December 28, 2015 10:29
Shitty PHP
<?
/*
PHP takes the design of Perl (ugly), the interfaces
of C (low-level and clunky), and the OO of C++
(an impure mess). Some things are completely broken,
and every API is either inconsistent or just
inconvenient.
Its only utility is its output of inline text, which
<?php
class base58
{
static public $alphabet = "123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ";
public static function encode($int) {
$base58_string = "";
$base = strlen(self::$alphabet);
while($int >= $base) {
@puneetkay
puneetkay / download.php
Created October 31, 2013 12:55
Force download with php
<?php
function serve_file_resumable ($file, $contenttype = 'application/octet-stream') {
// Avoid sending unexpected errors to the client - we should be serving a file,
// we don't want to corrupt the data we send
@error_reporting(0);
// Make sure the files exists, otherwise we are wasting our time
if (!file_exists($file)) {
@BlakeTurner
BlakeTurner / to-markdown.php
Created June 20, 2013 20:25
Convert HTML to Markdown in PHP. Great for migrating away from terrifying wysiwyg code.
<?php
/*
* to-markdown - an HTML to Markdown converter for PHP
*
* Copyright 2013, Blake Turner
* Licenced under the MIT licence
*
*/
@ihumanable
ihumanable / Excel.php
Last active February 6, 2024 06:24
Simple Excel Writer in PHP
<?php
/**
* Simple excel writer class with no external dependencies, drop it in and have fun
* @author Matt Nowack
* @link https://gist.github.com/ihumanable/929039/edit
* @license Unlicensed
* @version 1.0
*/
class Excel {