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
@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"`
@aamnah
aamnah / wifi_rpimonitord
Created October 2, 2013 16:44
Add a WiFi icon to the RPi-Monitor status page. Since I use a WiFi adapter with my raspberry pi and not an ethernet cable, it makes sense to be able to monitor WiFi bandwidth and speed. [sudo nano /etc/rpimonitord.conf.d/default.conf] and add the following at the end of the file.
###############################################################
# Graph WLAN
###############################################################
dynamic.17.name=wifi_received
dynamic.17.source=/sys/class/net/wlan0/statistics/rx_bytes
dynamic.17.regexp=(.*)
dynamic.17.postprocess=$1*-1
dynamic.17.rrd=DERIVE
dynamic.18.name=wifi_send
@aamnah
aamnah / vhosts.sh
Created June 4, 2014 08:51
Bash script to create Virtual host files [source](http://ubuntuforums.org/showthread.php?t=2106950)
#!/bin/bash
# Source: http://ubuntuforums.org/showthread.php?t=2106950
#Check for root
true="true"true="true"
ROOT_UID=0
overwrite=""
if [ "$UID" -ne "$ROOT_UID" ]; then
echo "Must be run as root, use sudo."
exit 0
fi
@aamnah
aamnah / lamp.sh
Last active February 19, 2024 11:51
Bash script to install Apache, MySQL and PHP as well as PHPMyAdmin and some tweaks. For Debian and Ubuntu. To run, copy the script to the server and run ``bash lamp.sh``
#!/bin/sh
#######################################
# Bash script to install an AMP stack and PHPMyAdmin plus tweaks. For Debian based systems.
# Written by @AamnahAkram from http://aamnah.com
# In case of any errors (e.g. MySQL) just re-run the script. Nothing will be re-installed except for the packages with errors.
#######################################
#COLORS
@aamnah
aamnah / install-apps.sh
Last active June 24, 2023 13:14
Bash script to install packages [Git, s3cmd] on a new system. For Debian and Ubuntu. To run, copy the script to the server and run ``bash install-apps.sh``
#!/bin/bash/
#######################################
# Bash script to install apps on a new system (Ubuntu)
# Written by @AamnahAkram from http://aamnah.com
#######################################
## Update packages and Upgrade system
sudo apt-get update -y
## Git ##
# 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 / grunt-snippets.sh
Last active October 21, 2017 18:31
Bash script for creating Grunt snippets for Sublime Text (gruntfile, cssmin, imagemin, uglify, s3, watch)
#!/bin/bash
# Author: Aamnah Akram
# URL: http://aamnah.com
# Email: hello@aamnah.com
# Description: Bash script for creating Grunt snippets for Sublime Text (gruntfile, cssmin, imagemin, uglify, s3, watch)
# Install: Open a Terminal and `cd` to the folder you downloaded the script in.
# Run the script by typing `bash grunt-snippets.sh`. It will add all the below snippets to the packages folder.
cd ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/User
@aamnah
aamnah / install-wp.sh
Last active July 1, 2019 06:59
Install WordPress via Shell
# Colors
Color_Off='\033[0m' # Color Reset
Red='\033[0;31m' # Red
Green='\033[0;32m' # Green
Yellow='\033[0;33m' # Yellow
Cyan='\033[0;36m' # Cyan
# Bold
BRed='\033[1;31m' # Red
BGreen='\033[1;32m' # Green