Skip to content

Instantly share code, notes, and snippets.

View ichadhr's full-sized avatar
Focusing

Chad ichadhr

Focusing
View GitHub Profile
@ichadhr
ichadhr / vm-resize-hard-disk.md
Last active February 5, 2017 18:56 — forked from christopher-hopper/vm-resize-hard-disk.md
Resize a Hard Disk for a Virtual Machine provisioned using Vagrant from a Linux base box to run using VirtualBox.

Resize a Hard Disk for a Virtual Machine

Our Virtual Machines are provisioned using Vagrant from a Linux base box to run using VirutalBox. If the Hard Disk space runs out and you cannot remove files to free-up space, you can resize the Hard Disk using some VirtualBox and Linux commands.

Some assumptions

The following steps assume you've got a set-up like mine, where:

@ichadhr
ichadhr / rm-old-kern.sh
Created November 10, 2015 17:37
Removing Old Kernel Ubuntu
#!/bin/bash
# Remove old linux
echo $(dpkg --list | grep linux-image | awk '{ print $2 }' | sort -V | sed -n '/'`uname -r`'/q;p') $(dpkg --list | grep linux-headers | awk '{ print $2 }' | sort -V | sed -n '/'"$(uname -r | sed "s/\([0-9.-]*\)-\([^0-9]\+\)/\1/")"'/q;p') | xargs sudo apt-get -y purge
@ichadhr
ichadhr / gulp.md
Created August 23, 2015 17:54
Gulp static server

package.json

"devDependencies": {
    "connect-livereload": "^0.5.3",
    "express": "^4.13.3",
    "gulp": "^3.9.0",
    "gulp-autoprefixer": "^2.3.1",
    "gulp-concat": "^2.6.0",
    "gulp-jshint": "^1.11.2",
    "gulp-minify-css": "^1.2.0",
@ichadhr
ichadhr / attach-pull-request.sh
Last active October 7, 2019 15:51 — forked from ihanson/attach-pull-request
Attaching a pull request to an existing GitHub issue
#!/usr/bin/env bash
read -p "GitHub username: " -ei $(git config --get github.user) USERNAME
read -sp "GitHub password: " PASSWORD
echo
read -p "Submit pull request to user: " TO_USER
read -p "Submit pull request to repository: " TO_REPO
read -p "Submit pull request to branch: " -ei master TO_BRANCH
read -p "Submit pull request from user: " -ei $USERNAME FROM_USER
read -p "Submit pull request from branch: " FROM_BRANCH
@ichadhr
ichadhr / toggleAttr.js
Created June 5, 2015 09:56
Toggle Attribute jQuery
$.fn.toggleAttr = function(a, b) {
var c = (b === undefined);
return this.each(function() {
if((c && !$(this).is("["+a+"]")) || (!c && b)) $(this).attr(a,a);
else $(this).removeAttr(a);
});
};
@ichadhr
ichadhr / postgres.bat
Last active October 7, 2019 15:48
Batch script Postgresql service
@ECHO OFF
CLS
goto CHECK
:CHECK
net session >nul 2>&1
if %errorLevel% == 0 (
goto :MENU
) else (
echo Checking permission privilege...
ping 1.1.1.1 -n 1 -w 500 > nul
#!/usr/bin/env bash
if [ ! -f package.json ]; then
echo "This script must be run from the ghost blog directory"
exit 1
fi
ZIP_URL=https://ghost.org/zip/ghost-latest.zip
PROJ_DIR=$(pwd)
TMP_DIR=$(mktemp -d -t ghost)