Skip to content

Instantly share code, notes, and snippets.

View EmranAhmed's full-sized avatar
🏠
Working from home

Emran Ahmed EmranAhmed

🏠
Working from home
View GitHub Profile
# Automatically instal the latest nginx
wget -O - http://nginx.org/keys/nginx_signing.key | sudo apt-key add -
#Make a backup copy of your current sources.list file
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
#Now copy the following repositories to the end of ` /etc/apt/sources.list`
echo "deb http://nginx.org/packages/mainline/ubuntu/ trusty nginx" | sudo tee -a /etc/apt/sources.list
echo "deb-src http://nginx.org/packages/mainline/ubuntu/ trusty nginx" | sudo tee -a /etc/apt/sources.list

Mac OS X 10.9 Mavericks

Custom recipe to get OS X 10.9 Mavericks running from scratch, setup applications and developer environment. I use this gist to keep track of the important software and steps required to have a functioning system after a semi-annual fresh install.

Install Software

The software selected is software that is "tried and true" --- software I need after any fresh install. I often install other software not listed here, but is handled in a case-by-case basis.

Install from App Store

@EmranAhmed
EmranAhmed / custom-cart-fee.php
Last active August 29, 2015 14:11 — forked from corsonr/gist:6182904
woocommerce Add custom fee / price to cart automatically
<?php
/**
* WooCommerce Extra Feature
* --------------------------
*
* Add custom fee to cart automatically
*
*/
function woo_add_cart_fee() {
server {
index index.php;
set $basepath "/var/www";
set $domain $host;
# check one name domain for simple application
if ($domain ~ "^(.[^.]*)\.dev$") {
set $domain $1;
set $rootpath "${domain}";
<?php
#!/usr/bin/env php
//usage: php envato-screenshots-downloader.php /path/to/save/screenshots http://url/to/screenshots/page
set_time_limit(0);
$dir = $argv[1];
$source = $argv[2];
print_r($argv);
mkdir ($dir);
$src = file_get_contents($source);
$pattern = '/src="(https:\/\/0.s3[a-zA-Z0-9_\-\.\/%]+)"/i';
@EmranAhmed
EmranAhmed / steps.md
Last active September 11, 2023 20:47
Create a bootable OS X ( 10.10 / 10.9 ) Yosemite / Mavericks USB drive.
  1. Download Yosemite

  2. Connect the USB drive ( 8 GB ) to your Mac.

  3. Using Disk Utility (it is found in Other under Launchpad), format the USB drive as Mac OS Extended (Journaled), and name it Yosemite. This can be done from the Erase tab within the app; make sure that there are no multiple partitions (turn to the Partition tab to verify and correct this). Choose GUID Partition Table as the partition scheme and choose OK

  4. Open Terminal (it is found in the same folder as the Disk Utility app).

  5. Use (paste) the following command:

    [If on Yosemite]: sudo /Applications/Install\ OS\ X\ Yosemite.app/Contents/Resources/createinstallmedia --volume /Volumes/Yosemite --applicationpath /Applications/Install\ OS\ X\ Yosemite.app

[If on Mavericks]: sudo /Applications/Install\ OS\ X\ Yosemite.app/Contents/Resources/createinstallmedia --volume /Volumes/Yosemite --applicationpath /Applications/Install\ OS\ X\ Yosemite.app -- nointeraction

@EmranAhmed
EmranAhmed / functions.php
Last active February 19, 2016 13:48 — forked from hasinhayder/functions.php
wp rewrite endpoint, edit url redirect
<?php
function init_url_rewrite_rule(){
add_rewrite_endpoint( 'edit',EP_PERMALINK | EP_PAGES | EP_ATTACHMENT );
if(get_option("EDIT_REWRITE_RULE")!=1){
flush_rewrite_rules();
update_option("EDIT_REWRITE_RULE",1);
}
}
function redirect_edit_url(){
@EmranAhmed
EmranAhmed / .bash_profile
Last active October 9, 2016 19:24 — forked from monkeymonk/.bash_profile
Bash Profile Long, bash example, zsh zshell, zshrc
# BASH Configuration and Aliases
# source: http://natelandau.com/my-mac-osx-bash_profile/
# source: https://github.com/mathiasbynens/dotfiles
# Sections:
# 0. Execute Only Once (if you want)
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
@EmranAhmed
EmranAhmed / style.css
Last active March 21, 2024 13:34 — forked from luetkemj/style.css
WordPress Default Style.css file styling
/* =============================================================================
WordPress WYSIWYG Editor Styles
========================================================================== */
.entry-content img {
margin: 0 0 1.5em 0;
max-width: 100%;
height: auto;
}
.alignleft, img.alignleft {
<?php
file_put_contents( 'progress.txt', '' );
$targetFile = fopen( 'testfile.iso', 'w' );
$ch = curl_init( 'http://ftp.free.org/mirrors/releases.ubuntu-fr.org/11.04/ubuntu-11.04-desktop-i386-fr.iso' );
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt( $ch, CURLOPT_NOPROGRESS, false );
curl_setopt( $ch, CURLOPT_PROGRESSFUNCTION, 'progressCallback' );
curl_setopt( $ch, CURLOPT_FILE, $targetFile );