Skip to content

Instantly share code, notes, and snippets.

View vincent99's full-sized avatar

Vincent Fiduccia vincent99

View GitHub Profile
@vincent99
vincent99 / controllers.application.js
Created September 28, 2018 21:49
owner stringify
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
init: function() {
this._super();
var cycle = Ember.Object.create();
cycle.set('cycle', cycle);
@vincent99
vincent99 / keybase.md
Created January 7, 2017 01:36
keybase.md

Keybase proof

I hereby claim:

  • I am vincent99 on github.
  • I am vincent99 (https://keybase.io/vincent99) on keybase.
  • I have a public key whose fingerprint is 1D6D 24C2 140D B782 A7B0 23A7 3517 24CD E295 EDE5

To claim this, I am signing this object:

@vincent99
vincent99 / README.md
Created May 24, 2016 18:57
Rancher on docker-for-mac with xhyve

Install Docker for Mac (http://beta.docker.com)

Install docker-machine-driver-xhyve (https://github.com/zchee/docker-machine-driver-xhyve)

brew install docker-machine-driver-xhyve sudo chown root:wheel $(brew --prefix)/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve sudo chmod u+s $(brew --prefix)/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve

Deploy the latest release

docker run -d --privileged -p 8080:8080 --name=rancher-server rancher/server:latest

or a build-master

@vincent99
vincent99 / DNS.java
Last active February 1, 2016 21:03
Examples of DNS resolution
// javac DNS.java
// java DNS blah
import java.net.*;
public class DNS {
public static void main(String[] args) {
java.security.Security.setProperty("networkaddress.cache.ttl", "0");
java.security.Security.setProperty("networkaddress.cache.negative.ttl", "0");
etcd-lb:
image: rancher/load-balancer-service
ports:
- 2379
links:
- etcd0
- etcd1
- etcd2
etcd0:
{
"id": "ec934d81-0db9-42fa-a6da-82813db92461",
"name": "resource.change",
"replyTo": null,
"resourceId": "1lb2",
"resourceType": "loadBalancer",
"publisher": null,
"transitioning": null,
"transitioningMessage": null,
"transitioningInternalMessage": null,
@vincent99
vincent99 / gist:491afed2306ba448dd89
Last active August 14, 2019 01:16
Simple example of subscribing to Rancher change events
/*
Setup:
npm install ws
Usage:
Create an API key in Rancher and start up with:
node socket.js address.of.rancher:8080 access_key secret_key project_id
*/
var WebSocket = require('ws');
POST / HTTP/1.1
Host: ec2.us-west-2.amazonaws.com
X-Amz-Date: 20150509T013140Z
X-Amz-Content-Sha256: c040d85fe255c0deb44974d26dca43bef55c2ae2b5e8bca7e2c14f8d72c7c186
Authorization: AWS4-HMAC-SHA256 Credential=AKIAJIMOGKSK5IBNAEMA/20150509/us-west-2/ec2/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date, Signature=66dd91436b16f09cb81c169813491413dc22250db534a2f2adf5b08078262743
Content-Type: application/x-www-form-urlencoded; charset=utf-8
X-API-HEADERS-RESTRICT: Content-Length
Connection: keep-alive
User-Agent: aws-sdk-nodejs/2.1.27 darwin/v0.10.33
Transfer-Encoding: chunked
@vincent99
vincent99 / gist:2086b67834e5d3b744c3
Created May 1, 2015 04:19
Set api.host setting
#!/bin/bash
project="?projectId=user"
host="1.2.3.4:8080"
url="http://${host}/v1/settings/api.host${project}"
orig=$(curl -s $url)
new=$(jq ". + {value: \"${newvalue}\"}" <<< "$orig")
link=$(jq -r ".links.self" <<< "$orig")
POST /v1/githubconfig HTTP/1.1
Host: localhost:8000
Connection: keep-alive
Content-Length: 168
authorization: Bearer ...
Origin: http://localhost:8000
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36
Content-Type: application/json
x-api-no-challenge: true
Accept: application/json