Skip to content

Instantly share code, notes, and snippets.

View greenbicycle's full-sized avatar
🐈
maintaining a state of cat-like awareness

Jeff Davis greenbicycle

🐈
maintaining a state of cat-like awareness
  • University of Arizona
  • Tucson, AZ
View GitHub Profile
@greenbicycle
greenbicycle / formattedDate.js
Created February 21, 2019 21:56
javascript date formatting unix timestamp
/* format a unixtimestamp as a javascript date
function formattedDate(unixTimestamp) {
let createdAtDateUTC = new Date(unixTimestamp * 1000);
let results = new Date(
createdAtDateUTC.getFullYear(),
createdAtDateUTC.getMonth(),
createdAtDateUTC.getDate(),
createdAtDateUTC.getHours(),
createdAtDateUTC.getMinutes(),
);
@greenbicycle
greenbicycle / dreamhost.go
Last active September 18, 2018 14:12
Dreamhost API GoLang Example
package main
import (
"fmt"
"io/ioutil"
"log"
"net/http"
"github.com/tkanos/gonfig"
)
@greenbicycle
greenbicycle / gist:58d0e1653fdb769a10371fea7d69e699
Last active September 15, 2018 22:24
Basic Bash commands for Ubuntu
apt-get update # update package info
apt-get upgrade # upgrade installed packages
dpkg -l | grep php # list all installed packages that contain the word php
apt-cache search bla-bla-blah # search for bla-bla-blah
apt-get install bla-bla-blah # install the bla-bla-blah package
apt remove composer # remove the composer
composer require league/climate # install the league/climate package
@greenbicycle
greenbicycle / wkhtmltopdf-install.sh
Created May 11, 2018 18:18
Install a specific version of wkhtmltopdf
#!/bin/bash
#
# Download and install the correct version of wkhtmltopdf
#
OLD_DIR=$(pwd)
mkdir wkhtmltopdf-temp
cd wkhtmltopdf-temp
@greenbicycle
greenbicycle / gitconfig.txt
Last active July 11, 2021 04:22
.gitconfig file for a Mac
# Change the stuff in angle brackets <>
[user]
name = <Your name>
email = <[email protected]>
[core]
autocrlf = input
safecrlf = true
pager =
excludesfile = /Users/<username>/.gitignore_global
editor = nano
@greenbicycle
greenbicycle / find-branch.sh
Created April 5, 2018 17:42
find branch name in git based on Manuscript case number
#!/bin/bash
#
# Find a branch name based on the Manuscript case number
#
# $1 should be a manuscript case number
# It will be copied to the clipboard
#
# sed is for removing the '* ' from the beginning of the line
@greenbicycle
greenbicycle / generate-key-pair
Created March 21, 2018 15:41
generate-key-pair
#!/bin/bash
#
# Generate key pair
# Will create 2 files:
# - private_key.pem
# - public_key.pem
#
openssl genrsa -aes256 -out private_key.pem 2048
@greenbicycle
greenbicycle / slack-alert.sh
Created March 10, 2017 21:49
Send a slack alert
#!/bin/bash
#
# Send a slack alert to a channel
#
# Find the SLACK_URL for the desired channel
#
#
# echo "Sending message to slack channel"
@greenbicycle
greenbicycle / goaccess-install
Created September 8, 2016 03:58
GoAccess install for Ubuntu and Debian
#!/bin/bash
#
# After this is run, edit /etc/goaccess.conf as needed
#
echo "deb http://deb.goaccess.io/ $(lsb_release -cs) main" | sudo tee -a /etc/apt/sources.list.d/goaccess.list
wget -O - https://deb.goaccess.io/gnugpg.key | sudo apt-key add -
sudo apt-get update
sudo apt-get install goaccess
@greenbicycle
greenbicycle / wp-cli-update
Created September 8, 2016 03:16
wp-cli-update script
#!/bin/bash
# wp-cli-update
#
# Download the latest wp-cli and put it wherever it is supposed
# to go.
#
WPCLI_LOCATION=/usr/local/sbin/wp
curl https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar \