Skip to content

Instantly share code, notes, and snippets.

@jmcclell
jmcclell / keybase.md
Created July 19, 2018 18:55
keybase.md
View keybase.md

Keybase proof

I hereby claim:

  • I am jmcclell on github.
  • I am jmcclell (https://keybase.io/jmcclell) on keybase.
  • I have a public key ASDUvWhJOeRBTzFftu-EnWeCdIxpWJ-oRHboumOxJciW1wo

To claim this, I am signing this object:

View gist:9c6261cf8ad8ac0592c09253196954eb
jason@mbp15r:~ > kops create cluster east.kube.REDACTED \
--node-count 3 \
--zones "us-east-1a,us-east-1b,us-east-1c" \
--master-zones "us-east-1a,us-east-1b,us-east-1c" \
--dns-zone kube.REDACTED \
--master-size m5.xlarge \
--node-size m5.xlarge \
--topology private \
--networking kube-router \
--ssh-public-key ~/.ssh/t.dsc.tv.pub \
@jmcclell
jmcclell / Patterns.md
Last active March 20, 2018 20:08
Concurrency Patterns in Go-Lang
View Patterns.md

Concurrency Patterns in Go-Lang

Channels Primer

Creating Channels

Channels are created via the builtin make function. We specify the type as chan {datatype} where by {datatype} represents the type of data that can be written to and read from the channel.

View Advanced-FP-with-Scala.md

Advanced Functional Programming with Scala - Notes

Copyright © 2017 Fantasyland Institute of Learning. All rights reserved.

1. Mastering Functions

A function is a mapping from one set, called a domain, to another set, called the codomain. A function associates every element in the domain with exactly one element in the codomain. In Scala, both domain and codomain are types.

val square : Int => Int = x => x * x
View gist:3d013ed1cbd0ca593d76
/**
* @Route("/contact", name="_demo_contact")
* @Template()
*/
public function contactAction(Request $request)
{
$contact = new Contact();
// Set a default for message inside the data object itself.
// I expect that if message is missing in the request, this value will be used as the default
$contact->setMessage("Default message from controller");
View gist:c700d086cd4a87c88775
{% for image in images %}
{% image image.input
filter='jpegoptim' output=image.output %}
<img src="{{ asset_url }}" alt={{ image.alt }}"/>
{% endimage %}
// image.input ex: @AcmeFooBundle/Resources/public/images/example.jpg
// iamge.output ex: /images/example.jpg
View gist:11d9d9e1381d81554022
<?php
namespace JLM\SerializerExpressionBundle\ExpressionLanguage;
use Symfony\Component\ExpressionLanguage\ExpressionLanguage as BaseExpressionLanguage;
use Symfony\Component\ExpressionLanguage\Expression;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\ExpressionLanguage\ParserCache\ParserCacheInterface;
@jmcclell
jmcclell / gist:9749594
Created March 24, 2014 21:31
sysadmin tips
View gist:9749594
Delete a line in a file (great for removing offending keys in known_hosts)
sed -i.bak -e '134d' /root/.ssh/known_hosts
will delete line #134 and back p the file as known_hosts.bak
View rationals.scala
class Rational(initialNumer: Int = 1, initialDenom: Int = 1) {
require(initialDenom != 0, "denominator must be nonzero")
private val gcd = {
def gcdRec(x: Int, y: Int): Int = {
if(y == 0) x else gcdRec(y, x % y)
}
abs(gcdRec(initialNumer, initialDenom))
}
View gist:7623150
# FOS Rest
fos_rest:
param_fetcher_listener: true
body_listener: true
format_listener:
rules:
path: ~
host: ~
priorities:
name: [json, html]