Skip to content

Instantly share code, notes, and snippets.

View hsali's full-sized avatar

Hafiz Shehbaz Ali hsali

View GitHub Profile
@hsali
hsali / strong-passwords.php
Created October 23, 2016 17:20 — forked from tylerhall/strong-passwords.php
A user friendly, strong password generator PHP function.
<?PHP
// Generates a strong password of N length containing at least one lower case letter,
// one uppercase letter, one digit, and one special character. The remaining characters
// in the password are chosen at random from those four sets.
//
// The available characters in each set are user friendly - there are no ambiguous
// characters such as i, l, 1, o, 0, etc. This, coupled with the $add_dashes option,
// makes it much easier for users to manually type or speak their passwords.
//
// Note: the $add_dashes option will increase the length of the password by
@hsali
hsali / play_random_file.sh
Created November 15, 2016 15:14
Script to select the random file to play video or audio .
#!/bin/bash
if [ "$1" = "" ]; then
echo "no directory defined!"
exit
fi
if [ "$2" = "" ]; then
echo "no file extension defined!"
@hsali
hsali / playing_random_audio_file.sh
Created November 15, 2016 18:18
Play random audio files from command line. It is mplayer which will play music command line.
#!/bin/bash
if [ "$1" = "" ]; then
echo "no directory defined!"
exit
fi
if [ "$2" = "" ]; then
echo "no file extension defined!"
@hsali
hsali / play_music.sh
Created November 16, 2016 04:26
Random play Music with mplayer in a specific folder
#!/bin/bash
if [ "$1" = "" ]; then
echo "no directory defined!"
exit
fi
if [ "$2" = "" ]; then
echo "no file extension defined!"
@hsali
hsali / mp4mp3.sh
Created November 16, 2016 16:15
mp4 file conversion to mp3 using ffmpeg commandline utility
#!/bin/bash
ffmpeg -i ${1} -f mp3 -ab 192000 -vn ${2}
@hsali
hsali / common.md
Created November 21, 2016 05:12
common bash usage commands for use

Common bash commands

Checking weather

curl wttr.in/Lahore

Play Music

mplayer filename.mp3 or filename.mp4 
@hsali
hsali / active-issues.sql
Created January 25, 2017 12:04 — forked from alysonla/active-issues.sql
Queries that power the open source section of the 2016 Octoverse report https://octoverse.github.com/
-- Active issues
-- Count of total active issues in the specified time frame
-- Source: githubarchive public data set via Google BigQuery http://githubarchive.org/
SELECT
COUNT(DISTINCT JSON_EXTRACT_SCALAR(events.payload, '$.issue.id')) AS events_issue_count
FROM (SELECT * FROM TABLE_DATE_RANGE([githubarchive:day.],TIMESTAMP('2015-09-01'),TIMESTAMP('2016-08-31')))
AS events
-- 10,723,492 active issues
@hsali
hsali / Matlab
Created February 23, 2017 18:27
#Stop the Mouse event problem
Type in the matlab
!synclient HorizTwoFingerScroll=0
Reference
* http://installfights.blogspot.com/2016/03/fix-mevent-case-in-matlab.html
* https://www.mathworks.com/matlabcentral/answers/112528-mevent-case-when-two-finger-scrolling
@hsali
hsali / create_subdomain_cpanel.php
Created March 24, 2017 13:32
PHP Script to create subdomain on cpanel .
function create_subdomain($subDomain,$cPanelUser,$cPanelPass,$rootDomain) {
// $buildRequest = "/frontend/x3/subdomain/doadddomain.html?rootdomain=" . $rootDomain . "&domain=" . $subDomain;
$buildRequest = "/frontend/x3/subdomain/doadddomain.html?rootdomain=" . $rootDomain . "&domain=" . $subDomain . "&dir=public_html/subdomains/" . $subDomain;
$openSocket = fsockopen('localhost',2082);
if(!$openSocket) {
return "Socket error";
exit();
@hsali
hsali / datatables.php
Created July 14, 2017 16:03
datables file which is located in config/datatables.php
<?php
return [
/**
* DataTables search options.
*/
'search' => [
/**
* Smart search will enclose search keyword with wildcard string "%keyword%".
* SQL: column LIKE "%keyword%"