Skip to content

Instantly share code, notes, and snippets.

View jimmycuadra's full-sized avatar
☠️
GitHub profits from the separation of families and the deaths of children.

jimmycuadra

☠️
GitHub profits from the separation of families and the deaths of children.
View GitHub Profile
@jimmycuadra
jimmycuadra / jquery-template-example.html
Created June 20, 2011 21:45
jQuery Template example
<!DOCTYPE html>
<html>
<head>
<title>jQuery Template Example</title>
</head>
<body>
<ul id="engineers"></ul>
<script id="tmpl-engineer" type="text/x-jquery-tmpl">
<li>${name}</li>
@jimmycuadra
jimmycuadra / cloud-config.yml
Last active April 19, 2021 03:04
CoreOS cloud-config for DigitalOcean with iptables firewall
#cloud-config
coreos:
etcd:
# generate a new token for each unique cluster from https://discovery.etcd.io/new
discovery: https://discovery.etcd.io/<token>
# multi-region deployments, multi-cloud deployments, and droplets without
# private networking need to use $public_ipv4
addr: $private_ipv4:4001
peer-addr: $private_ipv4:7001
@jimmycuadra
jimmycuadra / kubecon_proposal.md
Created September 25, 2015 11:01
KubeCon proposal: Deploying Kubernetes Clusters with Terraform and CoreOS

Deploying Kubernetes Clusters with Terraform and CoreOS

Kubernetes is complex software and setting up a new cluster can be difficult. While there are easy approaches like Google Container Engine, you may want to customize your cluster in various ways, or simply understand how it all works. A great way to do this is to define your cluster as code using Terraform. In this talk, you'll learn how to use Terraform to deploy Kubernetes on CoreOS and EC2.

Takeaway

Terraform and CoreOS are a great combination for deploying Kubernetes clusters.

Abstract

[4] pry(main)> class Foo
[4] pry(main)* define_method(:end) do
[4] pry(main)* puts 'fuck u'
[4] pry(main)* end
[4] pry(main)* end
=> :end
[5] pry(main)> ls Foo
Foo#methods: end
[6] pry(main)> Foo.new.end
fuck u
@jimmycuadra
jimmycuadra / configuration.yaml
Last active April 16, 2019 07:44
Event Countdown for Home Assistant
# Don't set an `initial` value for this component in this file. Instead, set it by calling the `set_datetime` service.
# The reason for this is explained at https://www.home-assistant.io/components/input_datetime/
input_datetime:
event_countdown:
name: "Date of the event"
has_date: true
has_time: false
# Don't set an `initial` value for this component in this file. Instead, set it by calling the `set_value` service.
# The reason for this is explained at https://www.home-assistant.io/components/input_text/
input_text:
@jimmycuadra
jimmycuadra / clusterrolebindings.yml
Created February 23, 2017 01:36
Default RBAC cluster roles and cluster role bindings built into Kubernetes
apiVersion: v1
items:
- apiVersion: rbac.authorization.k8s.io/v1alpha1
kind: ClusterRoleBinding
metadata:
creationTimestamp: 2017-02-23T00:03:51Z
name: cluster-admin
namespace: ""
resourceVersion: "35"
selfLink: /apis/rbac.authorization.k8s.io/v1alpha1/clusterrolebindingscluster-admin
@jimmycuadra
jimmycuadra / lib.rs
Created July 12, 2018 07:21
Tilt-like template engine abstraction
extern crate askama; // doensn't really work cause it creates a struct for each template at compile time
extern crate handlebars;
extern crate liquid;
extern crate maud; // doesn't really work cause it creates templates from within Rust code with a macro
extern crate serde;
extern crate tera;
use std::fmt::Display;
use serde::Serialize;
@jimmycuadra
jimmycuadra / hook.sh
Created January 21, 2016 01:35
letsencrypt.sh hook script for dns-01 challenge using AWS Route 53
YOUR_HOSTED_ZONE_HERE="Route53 zone ID"
case "$1" in
"clean_challenge")
altname="$2"
challenge_token="$3"
keyauth_hook="$4"
aws route53 change-resource-record-sets --hosted-zone-id $YOUR_HOSTED_ZONE_HERE --change-batch "{\"Changes\":[{\"Action\":\"DELETE\",\"ResourceRecordSet\":{\"Name\":\"_acme-challenge.${altname}\",\"Type\":\"TXT\",\"TTL\":60,\"ResourceRecords\":[{\"Value\":\"\\\"${keyauth_hook}\\\"\"}]}}]}"
;;
#[test]
fn create_in_order() {
let core = Core::new().unwrap();
let mut client = TestClient::new(core);
let requests: Vec<FutureKeySpaceInfo> = (1..4).map(|_| {
kv::create_in_order( &client, "/test/foo", "bar", None)
}).collect();
let work = join_all(requests).and_then(|mut ksis: Vec<KeySpaceInfo>| {
struct Client {
members: Vec<Member>,
}
impl Client {
fn first_ok<F>(&self, callback: F) -> Result<GoodThing, Vec<BadThing>>
where
F: Fn(&Member) -> Result<GoodThing, BadThing>
{
let mut errors = Vec::with_capacity(self.members.len());