Skip to content

Instantly share code, notes, and snippets.

View softon's full-sized avatar

Shiburaj Pappu softon

View GitHub Profile
@softon
softon / calculatePercentage.php
Created January 11, 2016 04:55
A simple function to calculate percentage without checking the divisor for zero. Also includes precision point.
<?php
/**
* A simple function to calculate percentage without checking the divisor for zero.
* Also includes precision point
*
* @param $got
* @param $out
* @param int $precision
* @return float|int
@softon
softon / getOrdinal.php
Created January 11, 2016 05:00
A simple function to return the ordinal of any number
<?php
/**
* A simple function to return the ordinal of any number
* E.g: number = 1 => Ordinal = st
* E.g: number = 23 => Ordinal = rd
*
* @param int $number
* @return string
*/
<?php
return [
'AF' => 'Afghanistan',
'AX' => 'Aland Islands',
'AL' => 'Albania',
'DZ' => 'Algeria',
'AS' => 'American Samoa',
'AD' => 'Andorra',
'AO' => 'Angola',
@softon
softon / StatesOfIndia.php
Created January 13, 2016 10:29
A simple list of states of india
<?php
return [
'AP' => 'Andhra Pradesh',
'AR' => 'Arunachal Pradesh',
'AS' => 'Assam',
'BR' => 'Bihar',
'CT' => 'Chhattisgarh',
'GA' => 'Goa',
'GJ' => 'Gujarat',
@softon
softon / ArrayToCommaSeperatedString.php
Created June 15, 2016 13:47
Converts an Array to comma seperated string
<?php
function arrayToCommaSeperatedString($arr,$key=null){
$str = '';
if(is_null($key))
return $str;
foreach($arr as $arr_ele){
$str .= $$arr_ele[$key].", ";
@softon
softon / generateStrongPassword.php
Created June 15, 2016 13:55
Strong Password Generator
<?php
/**
* Code Snippet for Strong Password Generation
*
* @param int $length
* @param bool|false $add_dashes
* @param string $available_sets
* @return string
*/
function generateStrongPassword($length = 9, $add_dashes = false, $available_sets = 'luds')
@softon
softon / npp.bat
Created December 14, 2019 08:02
Notepad++ Compile and Execute Program (C,C++,JAVA,PYTHON)
npp_console 1 //open console
NPP_CONSOLE - //disable output of commands
npe_console m- //disable unnecessary output
con_colour bg= 191919 fg= F5F5F5 //set console colors
npp_save //save the file
cd $(CURRENT_DIRECTORY) //follow current directory
NPP_CONSOLE + //enable output
IF $(EXT_PART)==.c GOTO C //if .c file goto C label
IF $(EXT_PART)==.cpp GOTO CPP //if .cpp file goto CPP label
IF $(EXT_PART)==.java GOTO JAVA //if .java file goto JAVA label
@softon
softon / shibu.h
Last active March 4, 2020 16:55
Simple Utility Library for C Language
/*********************************************************
..........................................................
...SSSSSSS....HHHH...HHHH.HIIII.BBBBBBBBBB...UUUU...UUUU..
..SSSSSSSSS...HHHH...HHHH.HIIII.BBBBBBBBBBB..UUUU...UUUU..
..SSSSSSSSSS..HHHH...HHHH.HIIII.BBBBBBBBBBB..UUUU...UUUU..
.SSSSS..SSSS..HHHH...HHHH.HIIII.BBBB...BBBB..UUUU...UUUU..
.SSSSS........HHHH...HHHH.HIIII.BBBB...BBBB..UUUU...UUUU..
..SSSSSSS.....HHHHHHHHHHH.HIIII.BBBBBBBBBBB..UUUU...UUUU..
...SSSSSSSSS..HHHHHHHHHHH.HIIII.BBBBBBBBBB...UUUU...UUUU..
.....SSSSSSS..HHHHHHHHHHH.HIIII.BBBBBBBBBBB..UUUU...UUUU..
@softon
softon / key.vbs
Created April 18, 2020 17:02
Get the Windows Key from your Operating System
Set WshShell = CreateObject("WScript.Shell")
MsgBox ConvertToKey(WshShell.RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DigitalProductId"))
Function ConvertToKey(Key)
Const KeyOffset = 52
i = 28
Chars = "BCDFGHJKMPQRTVWXY2346789"
Do
Cur = 0
x = 14
@softon
softon / Indian States and Cities list in php
Created June 10, 2020 17:14 — forked from Faizanq/Indian States and Cities list in php
Indian States and Cities array list in php
<?php
return [
'Andhra Pradesh (AP)'=>[
'Adilabad',
'Anantapur',
'Chittoor',
'Kakinada',
'Guntur',