Skip to content

Instantly share code, notes, and snippets.

@kevincolten
kevincolten / links.md
Last active March 27, 2019 22:24
Graduate Class Links
@kevincolten
kevincolten / kevin-colten.md
Created March 19, 2019 18:13
Student Profile

layout: resume #don't touch categories: [ hire ] # don't touch

fullname: Kevin Colten jobtitle: Chief Technology Officer, Web Developer

location: Austin, TX blurb: 'A life-learner and new technology enthusiast, I work hard at the things I love: programming, teaching, and learning.'

@kevincolten
kevincolten / Checkers.js
Created September 5, 2015 18:44
Checkers
var colors = require('colors/safe');
var prompt = require('prompt');
function Checker(color, position) {
this.team = color;
this.symbol = null;
if (color === 'red') {
this.symbol = colors.red(String.fromCharCode(0x12022));
} else {
@kevincolten
kevincolten / vpn.md
Last active September 4, 2018 03:32
Setting up PIA and OpenVPN on a Raspberry Pi
  1. sudo apt-get update

  2. sudo apt-get upgrade -y

  3. sudo apt-get install openvpn unzip dnsutils geoip-bin -y

  4. (mkdir openvpn && cd openvpn && unzip ../openvpn.zip)

  5. ( echo username; echo password; ) | tee /home/pi/openvpn/pass.txt

  6. ( echo auth-user-pass pass.txt; echo auth-nocache;) | tee --append US\ East.ovpn

  7. sudo nano /etc/init.d/VPNConnection

#! /bin/sh
@kevincolten
kevincolten / port-forwarding.txt
Created August 17, 2018 16:54
Localhost in Windows VirtualBox
In your wWindows VM admin powershell:
netsh interface portproxy add v4tov4 listenport=3000 connectport=3000 connectaddress=10.0.2.2 protocol=tcp
@kevincolten
kevincolten / .gitignore
Last active August 16, 2018 15:21
Insightly Scripts
.env
node_modules
@kevincolten
kevincolten / function.php
Created August 4, 2018 18:55
Return all events
function GetUpcomingEvents() {
$events = array();
$index = 0;
$today = date( "m/d/Y" );
$args = array(
'post_type' => 'events',
'post_status' => 'publish',
'posts_per_page' => - 1,
'meta_key' => 'event_start_date',
'orderby' => 'event_start_date',
@kevincolten
kevincolten / bookmarklet.txt
Created July 17, 2018 11:48
Export all form entries from WPForms
// Bookmarklet via https://mrcoles.com/bookmarklet/ (Add to bookmarks bar)
javascript:(function()%7BArray.from(document.querySelectorAll('.form-details-action-switch%20option')).slice(1).forEach(option%20%3D%3E%20window.open(%20option.getAttribute('value')%20%2B%20'%26export%3Dall%26'%20%2B%20document.querySelector('.form-details-actions-export').getAttribute('href').split('%26').find(str%20%3D%3E%20str.includes('_wpnonce'))%2C%20'_blank'))%7D)()
@kevincolten
kevincolten / index.js
Created July 16, 2018 06:13
Wordpress - Match Selected Posts with Featured Image Export
const { xml2json, json2xml } = require('xml-js');
const { readFileSync, writeFileSync } = require('fs');
const postIds = require('./postIds').map(id => Number(id));
const xml = JSON.parse(xml2json(readFileSync('./export.xml')));
const comments = xml.elements.filter(element => element.type === 'comment');
const rss = xml.elements.find(element => element.name === 'rss');
const channel = rss.elements.find(element => element.name === 'channel');
const nonItems = channel.elements.filter(element => element.name !== 'item');
@kevincolten
kevincolten / index.js
Created June 18, 2018 22:03
Pivotal-GH Bookmarklet
// Convert to a bookmarklet at https://mrcoles.com/bookmarklet/
[...document.querySelectorAll('[data-id] a:not([aria-label])')]
.filter(el => el.href.includes('/c4eo/align-rails/pull/'))
.forEach(el => {
const tickets = el.innerText.split(']').join(' ').split('[').join(' ').split(',').join(' ').split(' ').filter(str => str[0] === '#');
const ticketEls = tickets.map(ticket => `
<a class="d-inline-block IssueLabel v-align-text-top labelstyle-de752c linked-labelstyle-de752c" style="background-color: #de752c; color: #ffffff; margin-right: 4px" title="${ticket}" href="https://www.pivotaltracker.com/n/projects/1519937/stories/${ticket.slice(1)}" target="_blank">${ticket}</a>
`);
el.parentNode.insertAdjacentHTML('beforeend', `<span class="labels lh-default">${ticketEls.join('')}</span>`);
});