Skip to content

Instantly share code, notes, and snippets.

- name: update-user-email
title: Update User's Email
description: Update a user's email address.
db:
connection: users
sql: update users set email = :email where id = :id
schema:
properties:
id:
type: integer
@paultyng
paultyng / kube-restart-counts.sh
Last active September 29, 2016 20:57
Get kubernetes restart counts > 0
kubectl get pods -o json |
jq '.items[] | .metadata.name + " " + (.status.containerStatuses[].restartCount | tostring)' -r |
awk '$2 > 0 { print $1 " " $2 }'
@paultyng
paultyng / dedent-template.js
Created September 5, 2016 15:42 — forked from zenparsing/dedent-template.js
Dedenting Template Strings
function dedent(callSite, ...args) {
function format(str) {
let size = -1;
return str.replace(/\n(\s+)/g, (m, m1) => {
if (size < 0)
size = m1.replace(/\t/g, " ").length;
<
%3C
&lt
&lt;
&LT
&LT;
&#60
&#060
&#0060
&#00060
@paultyng
paultyng / finding-programming-answers.md
Last active October 9, 2015 20:04
Finding stuff about programming online
@paultyng
paultyng / 01-c9-workspace-config.png
Last active October 9, 2015 15:25
C9 Rails Getting Started
01-c9-workspace-config.png
@paultyng
paultyng / gist:3236880
Created August 2, 2012 13:03
SES Setup for IIS Relay

Instructions taken from Amazon's docs and modified as necessary.

1. Install stunnel:

  • Download from stunnel's download page
  • Run installer w/ default options, create self signed cert by answering questions
  • Open the c:\program files (x86)\stunnel\stunnel.conf file in notepad
  • Clear all the server configs (under Example SSL server mode services section, won't have a client = yes line)
  • Create a new client config:
@paultyng
paultyng / VendorHoursGrammar.cs
Created July 16, 2012 18:39
Vendor Hours Grammar (Irony)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Irony.Parsing;
namespace IronyHours
{
public class HoursGrammar : Grammar
{
@paultyng
paultyng / gist:2830129
Created May 29, 2012 19:18 — forked from kylefritz/gist:2563866
Delete branches that have been merged into HEAD
#all local branches that are merged into HEAD
git branch -d `git branch --merged | grep -v '^*' | tr -d '\n'`
#Delete all remote branches that are merged into HEAD
#jump back to master
git co master
#get rid of all local branches not on origin
@paultyng
paultyng / getting-started.md
Last active September 28, 2015 15:43
Getting Started with Rails

Installation Instructions

  1. Install GitHub for Windows
  2. Install Ruby 2.2 (not x64)
  • Install folder should be c:\Ruby22
  • Check Add Ruby executables to your PATH
  1. Install the appropriate DevKit
  • Install folder should be c:\RubyDevKit
  1. Run Git Shell
  2. Go to the DevKit folder cd \RubyDevKit