Skip to content

Instantly share code, notes, and snippets.

git push -f #yolo

Tim Kennedy stretchkennedy

git push -f #yolo
Block or report user

Report or block stretchkennedy

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
stretchkennedy /
Created May 10, 2018
Check the age of all your js files before committing (using husky)
DIR="$(cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd)"
FILES="$(find "$DIR"/src -type f -name '*.js' -not -name '*.test.js')"
for f in $FILES; do
if [[ "$f" -nt bundle.js ]]; then
echo "$f is newer than bundle.js"
stretchkennedy / connect.js
Last active Jul 26, 2017
react state management idea
View connect.js
const schema = {
view: {
selectedUser: null
data: {
users: {
$id: ({ id }, state, path) => fetch(`/api/users/${id}`).then(res => res.json())
stretchkennedy / persist-turbolinks.js
Last active Mar 25, 2018
persist turbolinks position in vanilla js
View persist-turbolinks.js

Using python:

  • Find 4096 divided by 4.
  • Write a program that
    • takes a number from the command line and divides it by 4.
    • solves a thing called "FizzBuzz" up to the number 20. (hint: to get the remainder of a division, you need a thing called the modulo operator)
    • takes a number and runs through the steps of the Collatz conjecture.
    • takes a number, or numbers, and applies a formula that's actually useful to them. (if you're stuck for ideas, the quadratic formula could be interesting)
    • takes a list of numbers and adds them together. (hint: first use a for loop, then look at map from
    • takes a list of names and outputs something like Hello Ted, John, Alice, and Jane!.
# bash one-liner to run a simple (and possibly non-compliant) http server
ncat -l 2000 -k -c '/bin/echo -e "HTTP/1.0 200 OK\r\n\r\n<html><body><h1>Test page</h1></body></html>"'
# more comprehensive version that sets Content-Type and Content-Length
CONTENT='<html><body><h1>Test page</h1></body></html>'; ncat -l 2000 -k -c '/bin/echo -e "HTTP/1.0 200 OK\r\nContent-Type: text/html; charset=UTF-8\r\nContent-Length: '${#CONTENT}'\r\n\r\n'$CONTENT'"'
View output.html
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "">
<!-- This file was created with the aha Ansi HTML Adapter. -->
<html xmlns="">
<meta http-equiv="Content-Type" content="application/xml+xhtml; charset=UTF-8" />
<body style="color:white; background-color:black">
stretchkennedy /
Last active Jun 28, 2016
Coding challenge

Coding challenge


Mockup of a google maps view


function escape_chars {
sed 's/"/""/g'
function format {
date=$(git log -n1 --pretty=format:%cD "$1" | escape_chars)
author=$(git log -n1 --pretty=format:'%aN <%aE>' "$1" | escape_chars)
sha=$(git log -n1 --pretty=format:%h "$1" | escape_chars)
message=$(git log -n1 --pretty=format:%B "$1" | escape_chars)
echo "\"$date\",\"$author\",\"$sha\",\"$message\""
stretchkennedy /
Created Feb 24, 2016
Run bash commands in parallel
function mycommand {
sleep 1
for i in $(seq 1 10); do
mycommand & PIDS+=($(echo $! | sed 's/^\[[0-9]*\]//'));
wait ${PIDS[*]}
View shipyard.bash
if [ "$1" != "" ] && [ "$1" = "-h" ]; then
echo "Shipyard Deploy uses the following environment variables:"
echo " ACTION: this is the action to use (deploy, upgrade, node, remove)"
echo " DISCOVERY: discovery system used by Swarm"
echo " IMAGE: this overrides the default Shipyard image"
echo " PREFIX: prefix for container names"
echo " SHIPYARD_ARGS: these are passed to the Shipyard controller container as controller args"
echo " TLS_CERT_PATH: path to certs to enable TLS for Shipyard"
You can’t perform that action at this time.