Skip to content

Instantly share code, notes, and snippets.

@devpilot
devpilot / del_dir.php
Created December 24, 2011 07:59
Delete directory with content in it
<?php
/**
* Delete directory with content in it
* @author Pilot
* @param string $directory Directory to delete
*/
function del_dir($directory) {
$content = scandir($directory);
unset($content[0], $content[1]);
@devpilot
devpilot / thumb.func.php
Created January 17, 2012 23:46
Create image thumb
<?php
/**
* Create thumbnail from image file.
* <p>Supported format ".jpg", ".jpeg", ".png", ".gif"</p>
* @param string $directory
* Path to source directory
* @param string $image
* name of image file including extention
* @param string $destination
* path to where thumb image will be saved
@devpilot
devpilot / index.html
Created March 20, 2013 17:38
Node.js and socket.io example Simple real time chat app with node.js and socket io
<html>
<head>
<title>Socket Chat</title>
<style type="text/css">
#input {
width: 200px;
}
#messages {
position: fixed;
top: 40px;
@devpilot
devpilot / .gitconfig
Last active September 1, 2022 07:01
my git config file
[user]
name = ""
email = ""
[alias]
co = checkout
br = branch
ca = commit -am
st = status
lg = log --oneline --all --graph --decorate
al = "!gitk --all&"
@devpilot
devpilot / sitemap.php
Created April 16, 2013 17:02
links store file generator
<?php
$doc = new DOMDocument('1.0');
$doc->formatOutput = true;
$doc->preserveWhiteSpace = false;
@$doc->load('sitemap.xml') or die('failed to load file'); //load xml file
$t1 = $doc->createElement('url');
$loc = $doc->createElement('loc', "http://www." . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
$t1->appendChild($loc);
@devpilot
devpilot / package.php
Last active August 29, 2015 14:19
Get details about PMPL package
<?php
/*
* Copy package options from below link to option.html
* http://203.147.88.14/24online/webpages/actualclientrenewal.jsp
*/
$data = file_get_contents("options.html");
// echo $data;
$pattrnA = "/VALUE =\"(.+)\"/";
preg_match_all($pattrnA, $data, $ids);
#!/bin/bash
#ishan dot karve at gmail dot com
#Script to emulate HTTP Client login method for 24Online
#Oct 2012, Jamnagar, Gujarat
#ver 0.2 alpha
#Per User Client
#Change variables below to reflect ur setup
#Change Log
# Better program loop
# Coloured debug
@devpilot
devpilot / mouse.py
Last active February 14, 2016 14:47
Track mouse position on screen (win)
#!/usr/bin/env python
from ctypes import windll, Structure, c_ulong, byref
class get_maus_pp(Structure):
_fields_ = [("x", c_ulong), ("y", c_ulong)]
mpp = get_maus_pp()
while True:
@devpilot
devpilot / product_qty_bought.php
Last active March 1, 2017 00:11
Woocommerce - count specific product quantity bought by customer in all orders
<?php
/**
* Woocommerce - count specific product quantity bought by customer in all orders
*
* @param (int) $product_id
* @return int|bool
* @author devpilot
**/
function product_qty_bought($product_id){
@devpilot
devpilot / bc_exchange.php
Last active April 21, 2017 07:25
Fetch btc exchange rate
<?php
/**
* @package bc_exchange
* @version 1.2
*/
/*
Plugin Name: BC Exchange
Plugin URI: https://github.com/devpilot/
Description: Get BTC Exchange rate from <a href="https://blockchain.info/">Blockchain</a>
Author: DevPilot