Skip to content

Instantly share code, notes, and snippets.

View mcnamee's full-sized avatar

▛▚▞▜ ▞▚ ▜▛ ▜▛ mcnamee

View GitHub Profile
@mcnamee
mcnamee / copy.js
Last active July 25, 2022 02:09
Copy & Paste bookmarklets for website that block copy/paste (eg. MS Teams, Defender)
View copy.js
javascript:(function(){
/*
* Highlight text and press the bookmarklet - the text is now in your clipboard
* Installation: Add this javascript to a new browser bookmark in the URL field
*/
let text = "";
const activeEl = document.activeElement;
const activeElTagName = activeEl ? activeEl.tagName.toLowerCase() : null;
/* Extract text from textarea/text input */
@mcnamee
mcnamee / index.html
Created May 14, 2021 06:00
Landing page
View index.html
<!doctype html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en" prefix="og: http://ogp.me/ns#"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang="en" prefix="og: http://ogp.me/ns#"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9" lang="en" prefix="og: http://ogp.me/ns#"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" prefix="og: http://ogp.me/ns#"> <!--<![endif]-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Coming Soon</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<!-- <meta http-equiv="refresh" content="30"> -->
@mcnamee
mcnamee / stage.php
Created April 28, 2020 03:11
Deploy to Staging
View stage.php
<?php
/** *********************************
* GIT Deploy to Pivotal Staging
*
* 1. Ensure this file exists in the root directory of your website
* on the staging server
* 2. Update the $config variables below
* 3. Browse to this file in your browser to "clone" the repo
* 4. Setup a Webhook to auto-deploy:
* URL: http://nbm:nbm@{{site_domain_name}}/stage.php
@mcnamee
mcnamee / bitbucket-pipelines.yml
Created March 4, 2020 22:51
Ultimate PHP + JS Pipelines Tests
View bitbucket-pipelines.yml
pipelines:
custom:
# PHPCS
# ---------------------------------------------------------------
phpcs:
- step:
image: edbizarro/gitlab-ci-pipeline-php:7.4-alpine
caches:
- composer
script:
@mcnamee
mcnamee / Multiple Deploy Keys in GitHub.md
Last active February 14, 2023 13:52 — forked from mcfdn/Multiple Deploy Keys in GitHub.md
Using multiple GitHub deploy keys on a single server with a single user
View Multiple Deploy Keys in GitHub.md

Using multiple GitHub deploy keys on a single server with a single user

Within GitHub it is possible to set up two types of SSH key - account level SSH keys and and repository level SSH keys. These repository level SSH keys are known in GitHub as deploy keys.

Deploy keys are useful for deploying code because they do not rely on an individual user account, which is susceptible to change, to “store” the server keys.

There is, however, an ‘issue’ with using deploy keys; each key across all repositories on GitHub must be unique. No one key can be used more than once. This becomes a problem when deploying to repositories to the same server with the same user. If you create two keys, the SSH client will not know which key to use when connecting to GitHub.

One solution is to use an SSH config file to define which key to use in which situation. This isn’t as easy as it seems.. you might try something like this:

@mcnamee
mcnamee / IAMCredentials.json
Last active February 25, 2019 02:19 — forked from ServerlessBot/IAMCredentials.json
Minimum credential set for Serverless Framework
View IAMCredentials.json
{
"Statement": [
{
"Action": [
"apigateway:*",
"cloudformation:CancelUpdateStack",
"cloudformation:ContinueUpdateRollback",
"cloudformation:CreateChangeSet",
"cloudformation:CreateStack",
"cloudformation:CreateUploadBucket",
@mcnamee
mcnamee / phpcs.xml
Last active June 22, 2022 18:55
Wordpress PHPCS Config
View phpcs.xml
<?xml version="1.0"?>
<ruleset name="Pivotal Agency">
<description>Pivotal Wordpress Coding Standards</description>
<!-- Scan all files in directory -->
<file>.</file>
<!-- Scan only PHP files -->
<arg name="extensions" value="php"/>
@mcnamee
mcnamee / instagram-feed.php
Last active February 11, 2021 08:59
Fetch an Instagram Feed with PHP and Cache it locally
View instagram-feed.php
<?php
/**
* Fetches and Caches a Instagram Feed
*
* - Get an Instagram Developer Account here: https://www.instagram.com/developer/
* - Create a new client, using the 'redirect URI' as https://rudrastyh.com/tools/access-token
* - Get an access token here: https://rudrastyh.com/tools/access-token
* - This file will return JSON - so use some AJAX on the front-end to display
* - Add the instagram-feed-cache.json file as ignored, to .gitignore
*/
@mcnamee
mcnamee / centos-cpanel-upgrade-node-version.md
Created August 8, 2018 22:30
Upgrade NodeJS on Centos with Cagefs/cPanel
View centos-cpanel-upgrade-node-version.md

Clean up references to other node version packages

rm -f /etc/yum.repos.d/nodesource-el.repo
yum clean all

Remove Old Node version

@mcnamee
mcnamee / npm-cloudlinux.md
Last active October 16, 2023 00:40
Install Node / NPM into CloudLinux
View npm-cloudlinux.md

How to install Node.js & NPM on CentOS with CloudLinux and CageFS

Add node.js yum repository

yum install -y gcc-c++ make
curl -sL https://rpm.nodesource.com/setup_14.x | sudo -E bash -

Install node.js and NPM

yum install nodejs