Skip to content

Instantly share code, notes, and snippets.

View nasirkhan's full-sized avatar
🚀
Focusing

Nasir Khan Saikat nasirkhan

🚀
Focusing
View GitHub Profile
@nasirkhan
nasirkhan / post-commit
Created March 28, 2013 17:03
This is a post-commit hook for Github master and the Github Project Pages. You have to enable this hook at the github project root .git directory. The file path should be the following ".git/hooks/post-commit". If you are using Linux make sure the "post-commit" file has the execute permission. This hook will automatically sync the github master …
#!/bin/sh
# Mirror master in gh-pages
git checkout gh-pages
git merge master
git checkout master
.clearfix:after {
visibility: hidden;
display: block;
font-size: 0;
content: " ";
clear: both;
height: 0;
}
.clearfix { display: inline-block; }
/* start commented backslash hack \*/
git checkout gh-pages
git merge master
git push origin gh-pages
@nasirkhan
nasirkhan / comand.markdown
Last active April 10, 2024 16:56
Git, Github -- Keep a file in the project but do not track the changes.

Sometimes we need to keep a file in the project but do not want to track the changes, for example the config/configuration file or other setting file.

git has a solution to do this. First change the file you do not want to be tracked and use the following command.

git update-index --assume-unchanged FILE_NAME

and if you want to track the changes again use this command,

@nasirkhan
nasirkhan / git command.markdown
Last active May 12, 2022 03:17
`git` discard all local changes/commits and pull from upstream

git discard all local changes/commits and pull from upstream

git reset --hard origin/master

git pull origin master

@nasirkhan
nasirkhan / php and javascript page reditect.php
Last active April 6, 2016 11:16
php and javascript page reditect
$url = "index.php";
redirect($url);
function redirect($url) {
if (headers_sent()) {
die('<script type="text/javascript">window.location.href="' . $url . '";</script>');
} else {
header('Location: ' . $url);
die();
}
@nasirkhan
nasirkhan / remove_file_extension.sh
Last active October 7, 2021 15:17
Remove file extension using the linux shell script
```
#!/bin/sh
for file in `ls *.html`
do
newname=`echo $file|sed 's/\.html$//g'`
mv $file $newname
done
```
@nasirkhan
nasirkhan / bengali2english.php
Created March 26, 2014 07:41
Convert a Bengali (Bangla) Number to English Number
/**
*
* Input any number in Bengali and the following function will return the English number.
*
*/
function bn2enNumber ($number){
$search_array= array("১", "২", "৩", "৪", "৫", "৬", "৭", "৮", "৯", "০");
$replace_array= array("1", "2", "3", "4", "5", "6", "7", "8", "9", "0");
$en_number = str_replace($search_array, $replace_array, $number);
@nasirkhan
nasirkhan / doc_to_html.sh
Created April 11, 2014 18:16
convert .doc to .html using libreoffice command
# the following command will convert all the files to HTML which has the DOC extension.
find . -name "*.DOC" -type f -print0 |xargs -0 -I {} libreoffice --headless --convert-to html:HTML --outdir /home/nasir/output {}
@nasirkhan
nasirkhan / mysql_show_column_names
Last active August 29, 2015 14:01
Get all the column names of a MySQL database table
/*
* MY_DATABASE_NAME will be replaced by the name of your database
* MY_TABLE_NAME will be repaced by the name of your database table
*/
SELECT
`COLUMN_NAME`
FROM
`INFORMATION_SCHEMA`.`COLUMNS`
WHERE