Skip to content

Instantly share code, notes, and snippets.

View ronanmccoy's full-sized avatar

Ronan ronanmccoy

View GitHub Profile
@ronanmccoy
ronanmccoy / Rename Git Branch name
Created June 27, 2022 23:15
Rename branch name on local environment
git branch -m master <BRANCH>
git fetch origin
git branch -u origin/<BRANCH> <BRANCH>
git remote set-head origin -a
@ronanmccoy
ronanmccoy / scp_download.sh
Created May 17, 2022 06:19
Bash script to download a list of files from an AWS EC2 server.
#!/usr/bin/env bash
###############################################################################
## Script to download a list of files from a remote server on AWS EC2.
## Requirements are the pem file to connect to the server, the user, and
## the servers AWS domain (i.e. EC2 domain name). The goal is to build the
## SSH connection string and pass it to SCP.
##
## The SSH connection string for the EC2 instance should be in the format:
@ronanmccoy
ronanmccoy / gist:663840e5943ad99db994462b229900ff
Last active November 20, 2019 22:12
Listing Tables in MySQL database & generating mysql dump
/*
* List all the tables in a particular database, excluding some
*/
SELECT table_name
FROM information_schema.tables
WHERE table_schema = '[db name]'
AND table_name NOT IN ('table1', 'table2', 'table3')
AND table_name NOT LIKE 'another_table_%'
AND table_name NOT LIKE '%_some_other_pattern%';
@ronanmccoy
ronanmccoy / Open file in sublime text from terminal
Last active September 15, 2018 21:41
Open a file in sublime text 3 from terminal
/**
*
* The following is specific to macOS
*
*/
// Create symbolic link with the alias 'subl'.
$: ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl
// Use from terminal as follows:
@ronanmccoy
ronanmccoy / Githook for PHP Syntax - composer.json
Last active October 15, 2018 19:09
Githook to check PHP syntax before committing changes.
/**
*
* ******* IMPORTANT *******
* This is not a valid composer.json, but
* only an example of what to add to the valid
* composer.json file in your project.
*
* The scripts here will run with 'composer install'
* or 'composer update' (though be aware that 'composer
* update' will update everything defined in the
@ronanmccoy
ronanmccoy / bootstrap-grid.css
Last active April 27, 2017 07:27
Color Bootstrap Grid
div[class="row"] {
border: 1px dotted rgba(0, 0, 0, 0.5);
}
div[class^="col-"] {
background-color: rgba(255, 0, 0, 0.2);
border:1px dotted yellow;
}
@ronanmccoy
ronanmccoy / PwCallUrl.ps1
Created March 17, 2017 02:09
Powershell URL Request
$url = "http://www.google.com"
$log_file = "C:\MyScriptLogs\pwscript.logs"
$date = get-date -UFormat "%d/%m/%Y %R"
"$date [INFO] Execution of $url" >> $log_file
$other_file = "C:\MyScriptLogs\response.log"
$request = [System.Net.WebRequest]::Create($url)
@ronanmccoy
ronanmccoy / Vagrantfile
Last active September 30, 2020 15:19
A vagrantfile and provisions script for a local LAMP development environment. This installs PHP7.2, MySQL, and Apache. The provision script also includes additional services that can be installed. The VM is configured to run a single site from /var/www/html/ in the the guest (which is mapped to ./webroot).
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/xenial64"
@ronanmccoy
ronanmccoy / .gitignore
Last active September 15, 2018 21:54
A generic .gitignore file, specific to the work I generally do these days (2015ish). Modify as needed before using.
###### Generic Stuff ######
*.bak
*.old
*.swp
*.log
.DS_Store
.Trashes
Thumbs.db
archive/ # old stuff I'm just not ready to toss.
notes/ # my dev notes, copy from client, project descriptions, etc.
@ronanmccoy
ronanmccoy / Boxstarter Base Dev Machine Setup
Last active November 7, 2016 23:37
The base set up for my development machine. Using boxstarter and chocolatey to get the machine up and running. This is still a work in progress.
#RM 11/4/2016
#-------------------------------#
# Customize Windows    #
#-------------------------------#
# Setup windows to show hidden files, hidden folders, and system files, show file extensions, and remove file path in title.
# See http://boxstarter.org/WinConfig for more info.
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -DisableShowProtectedOSFiles -EnableShowFileExtensions -DisableShowFullPathInTitleBar
# Also set options for the taskbar. See http://boxstarter.org/WinConfig for more info.