Skip to content

Instantly share code, notes, and snippets.

View ethernetdan's full-sized avatar

Dan Gillespie ethernetdan

  • Indent
  • New York, NY
View GitHub Profile
@ethernetdan
ethernetdan / FirebaseListAdapter.java
Created April 16, 2014 16:49
Open Source class for helping to connect ListViews to Firebase
package com.firebase.androidchat;
import android.app.Activity;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import com.firebase.client.ChildEventListener;
import com.firebase.client.DataSnapshot;
<html>
<head>
<script src="http://code.jquery.com/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="./layer.js"></script>
</head>
<body>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="canvas">
<g>
<rect x="10" y="10" height="110" width="110" style="stroke:#ff0000; fill: #0000ff" transform="rotate(261.042 60 60)">
#!/usr/bin/env bash
ROOT_DIR=~/repos
function main() {
export REMOTE=$1
info "Checking the validity of remote $REMOTE"
checkRepo $REMOTE
repo=$(parseRepo)
function getRCPods() {
ARGS=$2
selector=$(kubectl get rc/$1 --template='{{range $k, $v := .spec.selector}}{{printf "%s=%s" $k $v}}{{end}}' $ARGS)
kubectl get pods --selector="$selector" --template='{{range .items}}{{printf "%s\n" .metadata.name}}{{end}}' $ARGS
}
alias pods=getRCPods
@ethernetdan
ethernetdan / MainActivity.java
Created January 25, 2014 23:54
it's a gist, get it?
package com.ampvita.bubbleserver;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothServerSocket;
import android.bluetooth.BluetoothSocket;
import android.os.Handler;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.ActionBar;
import android.support.v4.app.Fragment;
import android.os.Bundle;
Flag --address has been deprecated, see --insecure-bind-address instead.
I0326 17:18:39.285185 5 feature_gate.go:189] feature gates: map[ExperimentalCriticalPodAnnotation:true]
I0326 17:18:39.461281 5 config.go:527] Will report 10.128.0.2 as public IP address.
I0326 17:18:39.469747 5 gce.go:291] Using GCE provider config {Global:{TokenURL: TokenBody: ProjectID: NetworkName: NodeTags:[kube-up-down-test-minion] NodeInstancePrefix:kube-up-down-test-minion Multizone:false}}
I0326 17:18:39.469783 5 gce.go:331] Using existing Token Source &oauth2.reuseTokenSource{new:google.computeSource{account:""}, mu:sync.Mutex{state:0, sema:0x0}, t:(*oauth2.Token)(nil)}
I0326 17:18:39.484635 5 server.go:148] Initalizing deserialization cache size based on 180MB limit
E0326 17:18:39.505123 5 reflector.go:199] k8s.io/kubernetes/plugin/pkg/admission/serviceaccount/admission.go:103: Failed to list *api.ServiceAccount: Get http://127.0.0.1:8080/api/v1/serviceaccounts?resourceVersion=0: dial tcp 12
1. Create [][]*Variant the size of the number of scenarios.
1. Sort scenarios by number of variants
2. Descending from highest variant, iterate through each scenario (greedy)
a. Create []*Variant array (size of number of variants)
b. Iterate through each variant:
i. Iterate through machines, attempting to add variant constrained by:
a) scenarios are mutually exclusive
b) scenario exclusion list
ii. Create machine if no acceptable machine can be found.
iii. Add pointer to variant to []*Variant array for scenario
#!/bin/bash
# Setup host
hostnamectl set-hostname foreman-1.lab.coreos.systems
# Configure repos
yum -y install yum-utils
yum-config-manager -y --enable rhel-7-server-optional-rpms
rpm --import https://www.centos.org/keys/RPM-GPG-KEY-CentOS-7
yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
@ethernetdan
ethernetdan / google-cloud.repo
Last active June 6, 2018 18:40
Google Cloud RHEL Repo
[google-cloud-sdk]
name=Google Cloud SDK
baseurl=https://packages.cloud.google.com/yum/repos/cloud-sdk-el7-x86_64
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg
https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
@ethernetdan
ethernetdan / kubeconfig.tf
Created July 31, 2018 13:31
Terraform Kubeconfig
# Create Kubeconfig to access cluster.
output "kubeconfig" {
value = <<EOF
apiVersion: v1
kind: Config
clusters:
- name: huv-cluster
cluster:
api-version: v1
server: "https://${google_container_cluster.huv_cluster.endpoint}"