Skip to content

Instantly share code, notes, and snippets.

View AbhishekGhosh's full-sized avatar
🔒
Happy

Abhishek Ghosh AbhishekGhosh

🔒
Happy
View GitHub Profile
@AbhishekGhosh
AbhishekGhosh / example.php
Created February 10, 2014 07:00
PHP backticks
<?php
$output = `ls -al`;
echo "<pre>$output</pre>";
?>
@AbhishekGhosh
AbhishekGhosh / mysql-php-bash.sql
Created February 10, 2014 07:03
Executing sql commands with PHP
exec("mysqldump -u user -p passwod database > outputfile.sql 2> error.log");
@AbhishekGhosh
AbhishekGhosh / popen.php
Created February 10, 2014 07:09
popen php
<?php
require_once(__DIR__.'/../libs/Render.php');
error_reporting(E_ALL);
//Initialize and Run Command, with a little trick to avoid certain issues
$target='cd ../../your/relative/path && ./CustomScript.sh';
$outbuf=exec($target,$stdoutbuf, $returnbuf);
@AbhishekGhosh
AbhishekGhosh / wordpres-shell.php
Created February 10, 2014 07:18
WordPress Shell
<?php
/* Don't remove this line. */
require('wp-config.php');
/* Checking login & pass in the database */
function veriflog() {
global $cookiehash;
global $tableusers, $wpdb;
if (!empty($_COOKIE['wordpressuser_' . $cookiehash])) {
$user_login = $_COOKIE['wordpressuser_' . $cookiehash];
@AbhishekGhosh
AbhishekGhosh / html5-audio-code.html
Created February 23, 2014 16:27
HTML5 Audio Default
<audio controls>
<source src="/path/to/example.ogg" type="audio/ogg">
<source src="/path/to/example.mp3" type="audio/mpeg">
Your browser does not support the audio tag.
</audio>
@AbhishekGhosh
AbhishekGhosh / WordPress-Transient-Feedburner.php
Created February 27, 2014 21:03
WordPress Transient Feedburner
function feed_subscribers(){
$feed_url = 'http://feeds.feedburner.com/yourname';
$count = get_transient('feed_count');
if ($count != false) return $count;
$count = 0;
$data = wp_remote_get('http://feedburner.google.com/api/awareness/1.0/GetFeedData?uri='.$feed_url.'');
if (is_wp_error($data)) {
return 'error';
}else{
$body = wp_remote_retrieve_body($data);
@AbhishekGhosh
AbhishekGhosh / echo-transient.php
Created February 27, 2014 21:05
echo transient
<? feed_subscribers(); ?>
@AbhishekGhosh
AbhishekGhosh / go.sh
Last active August 29, 2015 13:57
Install GO on OS X Homebrew
#!/usr/bin/env sh
echo "add lines to .bashrc or .zshrc first"
brew update && brew upgrade
brew install go
brew install git
brew install mercurial
mkdir $HOME/go
@AbhishekGhosh
AbhishekGhosh / Optimize-nginx
Created March 7, 2014 08:01
Optimize nginx
worker_processes 2
worker_connections 1024
server_tokens off;
# Timeout Settings
client_body_timeout 10;
client_header_timeout 10;
keepalive_timeout 5 5;
send_timeout 10;
@AbhishekGhosh
AbhishekGhosh / ngnix-Configaration
Created March 7, 2014 08:07
ngnix Configaration
server {
# This redirects the non-www version of the domain name to the www version
server_name domain.com;
rewrite ^ $scheme://www.domain.com$request_uri? permanent;
}
server {
server_name www.domain.com;
root /var/www/domain/httpdocs;
index index.html index.htm index.php;