Skip to content

Instantly share code, notes, and snippets.

View faizanayubi's full-sized avatar

Faizan Ayubi faizanayubi

View GitHub Profile
@faizanayubi
faizanayubi / commands.txt
Last active February 13, 2016 18:12
Common Ubuntu Commands
Change folder permissions and ownership
sudo chown -R username:group directory
remove all files and folder
rm -rf foldername
move contents of one foldr to another
mv -v public_html/* /home/mannan/web/viraltabloid.in/public_html/
tar a file
@faizanayubi
faizanayubi / shift_server.txt
Last active February 23, 2016 07:03
Shift a server
1. tar a file
tar -cf folder.tar folder/
2. Backup database
mysqldump -uroot -p database_name > dumpfilename.sql
3. transfer files to server
wget -m --ftp-user=cloudstuffs --ftp-password=pass123 ftp://ftp.cloudstuffs.com/public_html.tar
or
scp [email protected]:/home/vijay/webackups/milan/www.tar /var/www/
@faizanayubi
faizanayubi / NetworkCall
Created July 22, 2015 13:15
Network Call Android
// These two need to be declared outside the try/catch
// so that they can be closed in the finally block.
HttpURLConnection urlConnection = null;
BufferedReader reader = null;
// Will contain the raw JSON response as a string.
String forecastJsonStr = null;
try {
// Construct the URL for the OpenWeatherMap query
@faizanayubi
faizanayubi / word.php
Created May 10, 2015 09:11
Creating Word Document with PHP
<?php
header("Content-type: application/vnd.ms-word");
header("Content-Disposition: attachment;Filename=document_name.doc");
echo "<html>";
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=Windows-1252\">";
echo "<body>";
echo "<h1>My first document</h1>";
echo "</body>";
echo "</html>";
@faizanayubi
faizanayubi / SocialAPI
Created May 9, 2015 14:24
Social APIs
StumbleUpon
http://www.stumbleupon.com/services/1.01/badge.getinfo?url=http://swiftintern.com
Pinterest
http://widgets.pinterest.com/v1/urls/count.json?source=6&url=http://swiftintern.com
http://api.pinterest.com/v1/urls/count.json?callback%20&url=http://google.com
Delicious
http://feeds.delicious.com/v2/json/urlinfo/data?url=http://swiftintern.com
<?php
/**
* Photograph
*
* @package Main
* @subpackage Basic
* @author Faizan Ayubi
*/
class Photograph extends DatabaseObject {
protected static $table_name = "photographs";