Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View djm158's full-sized avatar

Dan McGrath djm158

View GitHub Profile
#!/usr/bin/env bash
if [ $# -le 1 ]
then
echo "Usage: get-npm-install \$PACKAGE_NAME \$PACKAGE_VERSION"
exit 1
fi
PKG_NAME=$1
PKG_VERSION=$2
@djm158
djm158 / loc.sh
Created July 12, 2018 14:20
lines of code per contributor
git ls-files | while read f; do git blame --line-porcelain $f | grep '^author '; done | sort -f | uniq -ic | sort -n
@djm158
djm158 / useful_bash_utilities.sh
Last active April 2, 2018 19:35
useful bash utilities
# grep for multiple patterns and replace a pattern (or leave 'bar' empty to remove that pattern)
grep 'pattern1\|pattern2\|pattern3' file | sed 's/foo/bar/g'
# list directoy, grab date, time, and filename, sort by most recent
ls -l | awk '{print $6, $7, $8, $9}' | sort --reverse
# if you only want to ls by time
# add -ltr for reverse
ls -lt
@djm158
djm158 / gh-pages-deploy.md
Created March 3, 2018 18:39 — forked from cobyism/gh-pages-deploy.md
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

#!/bin/bash
# 2 args
# 1. path to file (required)
# 2. output file (if renaming, else stays the same)
if [ ! -f $1 ];
echo "$1 not found"
fi
@djm158
djm158 / install_libssh2-1.8.0_from_source.sh
Last active February 28, 2018 18:42
wget libssh2-1.8 and build from source
# this assumes you have make autoconf and libtool, run the following otherwise:
# sudo apt-get install make autoconf libtool
echo "BUILDING LIBSSH FROM SOURCE"
wget https://github.com/libssh2/libssh2/archive/libssh2-1.8.0.tar.gz
tar -xvzf libssh2-1.8.0.tar.gz
# need to run this in a subshell so autotools understands we are working in libssh2-libssh2-1.8.0
(
cd libssh2-libssh2-1.8.0/
libtoolize -v
aclocal
@djm158
djm158 / projectpart2plan.md
Created March 14, 2017 05:14
Final Project Part 2 Gist

CS1520 Project Part 2 Proposal

Daniel McGrath djm158@pitt.edu

I am continuing my design of a personal promotional website. I plan on implementing the webpages I previously designed in PHP and adding more javascript functionality such as drop down menus with links to different sections of the website. I would like to implement some sort of blog as well.

Technical details

As of right now I plan on making a PHP website with a MySQL database (or any SQL database really). I'll contine to use Bootstrap to do the front end and mix in my own HTML/CSS/javascript wherever necessary.

@djm158
djm158 / projectplan.md
Created January 18, 2017 04:00
Project Plan

CS1520 Project Proposal

Daniel McGrath djm158@pitt.edu

I plan on designing a personal promotional website. I would like to include a project portfolio and ideally a blog but depending on time constraints it will at least be a page that displays my personal interests and activities I participate in.

Technical details

As of right now I plan on making a PHP website with a MySQL database (or any SQL database really). I'll most likely use Bootstrap to do the front end and mix in my own HTML/CSS/javascript wherever necessary.