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 / 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 / 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;
#[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());
[package]
name = "ruma-client-test"
version = "0.1.0"
[dependencies]
futures = "0.1.13"
tokio-service = "0.1.0"
[dependencies.hyper]
git = "https://github.com/hyperium/hyper"
@jimmycuadra
jimmycuadra / generic_assoc_type_constraint.rs
Last active May 11, 2017 10:18
Generic associated type constraint question
// In crate `endpoint`:
pub trait Endpoint {
type Request: TryInto<hyper::Request>;
type Response: TryFrom<hyper::Response>;
}
// In crate `client`:
pub struct Client;
@jimmycuadra
jimmycuadra / algo.txt
Created April 26, 2017 10:13
algo ansible output
$ ./algo
What provider would you like to use?
1. DigitalOcean
2. Amazon EC2
3. Microsoft Azure
4. Google Compute Engine (only for testing, see issue #369)
5. Install to existing Ubuntu 16.04 server
Enter the number of your desired provider
@jimmycuadra
jimmycuadra / kubelet.log
Created April 14, 2017 22:07
kubelet crash on rpi3
$ sudo journalctl -u kubelet
-- Logs begin at Fri 2017-04-14 13:36:03 PDT, end at Fri 2017-04-14 14:53:40 PDT. --
Apr 14 13:36:03 pearkube-03 kubelet[30954]: I0414 13:36:02.080311 30954 reconciler.go:190] UnmountVolume operation started for volume "kubernetes.io/secret/5b810d2c-2033-11e7-8e6e-b827ebfa0d18-wrapped_wrapped_wrapped_wrapped_wrapped_wra
Apr 14 13:36:03 pearkube-03 kubelet[30954]: I0414 13:36:02.080599 30954 reconciler.go:190] UnmountVolume operation started for volume "kubernetes.io/secret/5b810d2c-2033-11e7-8e6e-b827ebfa0d18-wrapped_wrapped_wrapped_wrapped_wrapped_wra
Apr 14 13:36:03 pearkube-03 kubelet[30954]: I0414 13:36:02.081036 30954 reconciler.go:190] UnmountVolume operation started for volume "kubernetes.io/secret/5b810d2c-2033-11e7-8e6e-b827ebfa0d18-wrapped_wrapped_wrapped_wrapped_wrapped_wra
Apr 14 13:36:03 pearkube-03 kubelet[30954]: I0414 13:36:02.081583 30954 reconciler.go:190] UnmountVolume operation started for volume "kubernetes.io/secret/5b810d2c-2033-11e7-8e6e-b827ebfa0d1
@jimmycuadra
jimmycuadra / compiler_output.txt
Last active March 5, 2017 00:11
Lifetime issue with futures
error[E0495]: cannot infer an appropriate lifetime for lifetime parameter in function call due to conflicting requirements
--> src/main.rs:39:37
|
39 | for item in self.collection.iter() {
| ^^^^
|
note: first, the lifetime cannot outlive the anonymous lifetime #1 defined on the body at 36:90...
--> src/main.rs:36:91
|
36 | fn dispatch(&self, input: &'static str) -> Box<Stream<Item = Success, Error = Error>> {
@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