Skip to content

Instantly share code, notes, and snippets.

View kcoyner's full-sized avatar

Kevin Coyner kcoyner

View GitHub Profile
@kcoyner
kcoyner / ilovenatalia.net.ini
Created June 22, 2013 19:49
Virtual host setup with django, uwsgi and nginx
[uwsgi]
vhost = true
plugins = python
socket = /run/uwsgi/app/ilovenatalia.net/ilovenatalia.net.socket
master = true
enable-threads = true
processes = 2
module = ilovenatalia.uwsgi:application
home = /home/kcoyner/.virtualenvs/ilovenatalia
chdir = /opt/django_apps/ilovenatalia
@kcoyner
kcoyner / lists.rustybear.com.ini
Last active December 18, 2015 21:29
Mailman, nginx, uwsgi and postfix working together on a Debian server. Make sure you install the Debian package uwsgi-plugin-cgi, which is a separate package from uwsgi.
# /etc/uwsgi/apps-available/lists.rustybear.com.ini
[uwsgi]
plugins = cgi
vhost = true
master = true
touch-reload = %p
pidfile = /run/uwsgi/app/lists.rustybear.com/pid
log-maxsize = 20971520
socket = 127.0.0.1:14014
chdir = /
@kcoyner
kcoyner / smartprompt.sh
Last active June 16, 2022 13:49
Creates a new git sensitive prompt with different information based on whether you are in a schroot or python virtualenv or a regular bash session. Load it from your .bashrc.
# Creates a new git sensitive prompt with different information based on
# whether you are in a schroot or python virtualenv or a
# regular bash session.
#
# Load it from your .bashrc with the following:
#
# if [ -f ~/bin/smartprompt.sh ]; then
# . ~/bin/smartprompt.sh
# fi
@kcoyner
kcoyner / remount.sh
Created March 3, 2016 19:01
remount an SD card with different privileges
#!/bin/bash
# Simple script to remount an already mounted SD card
# Also sets the readahead speed to 1024
# Kevin Coyner
# 2016-02-26
# # Parameters to be set
# #--------------------------------------------------------------------
@kcoyner
kcoyner / assessment.js
Created May 2, 2017 04:00
PCA assessment for Kevin Coyner
var salesTeam = [{name: {first: 'aleen', last: 'atkins'}, age: 26, sales: '$2314'},
{name: {first: 'alvaro', last: 'angelos'}, age: 55, sales: '$1668'},
{name: {first: 'denese', last: 'dossett'}, age: 29, sales: '$9248'},
{name: {first: 'douglas', last: 'denney'}, age: 53, sales: '$5058'},
{name: {first: 'earline', last: 'erickson'}, age: 19, sales: '$18876'},
{name: {first: 'herman', last: 'hazell'}, age: 25, sales: '$2746'},
{name: {first: 'homer', last: 'hirth'}, age: 26, sales: '$474'},
{name: {first: 'hwa', last: 'heidt'}, age: 53, sales: '$9607'},
{name: {first: 'hyon', last: 'hampshire'}, age: 46, sales: '$13598'},
@kcoyner
kcoyner / assessment-completed.js
Last active May 2, 2017 18:14
Completed version of the assessment - not finished within time limits
/* This is not my submitted version. That version can be found at:
https://gist.github.com/kcoyner/8ddc95ad78b022b1c58363b2ef90e080
I wanted to upload this version as it is 100% complete. I was able to complete all problems,
just not in the allocated amount of time. I got hung up on Part 5 on a stupid mistake, and
Part 6 took me another 15 minutes or so. Thank you. Kevin.]
*/
var salesTeam = [{name: {first: 'aleen', last: 'atkins'}, age: 26, sales: '$2314'},
{name: {first: 'alvaro', last: 'angelos'}, age: 55, sales: '$1668'},
{name: {first: 'denese', last: 'dossett'}, age: 29, sales: '$9248'},
@kcoyner
kcoyner / addGitHubRepoCollaborator.sh
Created May 24, 2017 12:37
Add a collaborator to a GitHub repo from the command line
curl -i -u "kcoyner:my_password" -X PUT -d '' 'https://api.github.com/repos/kcoyner/my_repo/collaborators/my_collaborator_id'

Keybase proof

I hereby claim:

  • I am kcoyner on github.
  • I am kcoyner (https://keybase.io/kcoyner) on keybase.
  • I have a public key ASBaBeH6o6xCnp2WYMdvLZ0TcwWadtnMPu1YyPUqd6p_OAo

To claim this, I am signing this object:

@kcoyner
kcoyner / whiteboard_browser_back_function.js
Last active November 11, 2017 23:17
Replicate in a web page the current, back and forward functionality of a browser - JS code only - full code in jsfiddle
// https://jsfiddle.net/934umzan/2/
var currentPages = [];
var backPages = [];
var forwardPages = [];
$('#submit').on('click', function(event) {
event.preventDefault();
var text = $('#text').val();
console.log(text);
@kcoyner
kcoyner / findLargestLevelOfTree.js
Created November 18, 2017 18:22
whiteboard exercise: find largest level of a binary tree
You may use a whiteboard or paper to sketch things out, but please write your code in an IDE so you can write tests to demonstrate that your code works, and you can paste that code into a Github Gist upon solution submission.
You may only use the Internet to remind yourself of syntax (e.g., on the MDN site), not to look up anything specifically about this problem. Be reasonable -- stay within the bounds of what would be permissible in a live industry interview.
## Largest level of tree?
You are given a binary tree whose nodes all have integer values (both positive and negative).
Determine which level of the tree is the "largest", i.e., you sum all the node values at that level, and determine which level has the largest sum.