Skip to content

Instantly share code, notes, and snippets.

View aamnah's full-sized avatar
💭
the learning never stops

Aamnah aamnah

💭
the learning never stops
View GitHub Profile
# install Homebrew if you don't already have it: http://mxcl.github.io/homebrew/
# On Mac, Homebrew with homebrew-dupes will allow you to easily upgrade nano to a newer version than the one that came with Mac OSX.
# [homebrew-dupes](https://github.com/Homebrew/homebrew-dupes):
# These formulae duplicate software provided by OS X, though may provide more recent or bugfix versions.
# Add the dupes formulae, then install a new version of nano.
brew tap homebrew/dupes
brew install nano
@aamnah
aamnah / gruntfile.sh
Last active August 29, 2015 14:15
Bash function to create gruntfile.js with starter code if it doesn't already exist. Type `gruntfile` to run.
color_green='\033[92m'
color_red='\033[91m'
color_off='\033[0m'
gruntfile() {
if [ -e "gruntfile.js" ] ; then
echo -e "${color_red}gruntfile.js already exists${color_off}"
if [ -e "Gruntfile.js" ] ; then
echo -e "${color_red}Gruntfile.js already exists${color_off}"
@aamnah
aamnah / grunt.sublime-snippet
Created February 15, 2015 12:12
Grunt snippets for Sublime Text
<!-- Emmet: snippet>description+tabTrigger+content{<![CDATA[ ]]>} -->
<!-- Gruntfile.js -->
<snippet>
<description>Gruntfile.js Skeleton</description>
<tabTrigger>grunt</tabTrigger>
<content><![CDATA[
module.exports = function(grunt) {
// Configure task(s)
@aamnah
aamnah / opencart_store_details.sql
Created February 26, 2015 07:20
MySQL command to Update Store Details for all existing Orders in an Opencart store
# Update store_id, store_name and store_url for all existing orders
#####################################################################
# store_id can be checked with `SELECT * FROM oc_store`. Default store = 0
UPDATE oc_order SET store_id=0, store_name="Store Name", store_url="http://domain.com";
@aamnah
aamnah / gravatar.php
Last active August 29, 2015 14:18
Gravatar
<?php
$email = "aamnah@aamnah.com";
$email_neat = strtolower(trim($email));
$email_hash = md5($email_neat);
$file_type = 'jpg';
$size = 80;
$gravatar = 'http://www.gravatar.com/avatar/'. $email_hash . '.' . $file_type. '?s=' . $size .'';
$gravatar_image = '<img src="'. $gravatar . '" />';
@aamnah
aamnah / index.html
Created October 28, 2015 14:07
Realtime JavaScript clock
<div id="time"></div>
@aamnah
aamnah / play.html
Last active October 28, 2015 20:45
play audio when clicked
<!-- image -->
<a href="javascript:play('dog')"><img src="img/dog.png"></img></a>
<!-- link -->
<a href="javascript:play('dog')">Dog</a>
<!-- audio file -->
<audio
id="dog"
src="media/dog.wav"
@aamnah
aamnah / oc.sh
Last active November 27, 2015 20:26
Bash script for OC install
#!/bin/bash
###
# Author: Aamnah
# Link: http://aamnah.com
# Description: Install script for Opencart 2.x on a Linux (Ubuntu/Debian) server
###
# Color Reset
Color_Off='\033[0m' # Text Reset
@aamnah
aamnah / oc_install_perms_2.0.1.0
Last active November 28, 2015 06:55
Opencart Permissions for install
chmod 777 config.php
chmod 777 admin/config.php
chmod 777 image/
chmod 777 image/cache/
chmod 777 image/catalog/
chmod 777 system/cache/
chmod 777 system/logs/
chmod 777 system/download/
chmod 777 system/upload/
@aamnah
aamnah / motd_raspi
Last active December 24, 2015 00:38
Custom MOTD for Raspberry Pi. Change city for weather (current is Lahore, Pakistan - you can get the city code [here](http://pastebin.com/dbtemx5F)), network interface (eth0 or wlan0, mine is wlan0 because i use wifi to connect to network), and /dev/root to your disk that you want to monitor. Add this to the end of .bashrc
################################
# CUSTOM MOTD FOR RASPBERRY PI
################################
let upSeconds="$(/usr/bin/cut -d. -f1 /proc/uptime)"
let secs=$((${upSeconds}%60))
let mins=$((${upSeconds}/60%60))
let hours=$((${upSeconds}/3600%24))
let days=$((${upSeconds}/86400))
UPTIME=`printf "%d days, %02dh %02dm %02ds" "$days" "$hours" "$mins" "$secs"`