Skip to content

Instantly share code, notes, and snippets.

Avatar

Daniel Platt hackzilla

View GitHub Profile
@hackzilla
hackzilla / cloud-config
Last active Aug 29, 2015
etcd + fleet, 3 node clust
View cloud-config
#cloud-config
coreos:
etcd:
#generate a new token for each unique cluster from https://discovery.etcd.io/new
discovery: https://discovery.etcd.io/<token>
addr: $public_ipv4:4001
peer-addr: $private_ipv4:7001
peer-election-timeout: 500
peer-heartbeat-interval: 100
View cloud-config
#cloud-config
hostname: {{ name }}
write_files:
- path: /etc/environment
permissions: 0644
content: |
COREOS_PUBLIC_IPV4={{ public_ip }}
COREOS_PRIVATE_IPV4={{ private_ip }}
View user_data
#!/bin/bash
MAC=`ifconfig enp0s33 | grep -o -E '([[:xdigit:]]{1,2}:){5}[[:xdigit:]]{1,2}'`
URL="http://192.168.0.2/config/web-backend/${MAC}"
coreos-cloudinit --from-url="${URL}"
@hackzilla
hackzilla / gist:75c2699eee323a608a92
Created Jul 10, 2014
CoreOS fails to switch channel from BETA to ALPHA
View gist:75c2699eee323a608a92
Jul 10 09:38:29 stats-backend-03 update_engine[828]: [0710/093820:INFO:omaha_request_action.cc(292)] Posting an Omaha request to https://public.update.core-os.net/v1/update/
Jul 10 09:38:29 stats-backend-03 update_engine[828]: [0710/093820:INFO:omaha_request_action.cc(293)] Request: <?xml version="1.0" encoding="UTF-8"?>
Jul 10 09:38:29 stats-backend-03 update_engine[828]: <request protocol="3.0" version="CoreOSUpdateEngine-0.1.0.0" updaterversion="CoreOSUpdateEngine-0.1.0.0" installsource="scheduler" ismachine="1">
Jul 10 09:38:29 stats-backend-03 update_engine[828]: <os version="Chateau" platform="CoreOS" sp="353.0.0_x86_64"></os>
Jul 10 09:38:29 stats-backend-03 update_engine[828]: <app appid="{e96281a6-d1af-4bde-9a0a-97b76e56dc57}" version="353.0.0" track="alpha" from_track="alpha" bootid="{d81f4999-614a-4465-b308-9d68a7286f7c}" oem="" machineid="8047bcfe70e049399f7dfd7d8a41a61c" lang="en-US" board="amd64-usr" hardware_class="" delta_okay="false" >
Jul 10 09:38:29 stats-backend-03 update_engine[828]: <pin
View Mac Dev Setup.md

Installing a Web Developer setup on OS X Mavericks

Install XQuartz

A version of the X.Org X Window System that runs on OS X

Download and install xquartz.macosforge.org

Install Brew

@hackzilla
hackzilla / split_classes.php
Created Dec 11, 2013
Split a file with loads on classes into individual files. Uses namespace to figure out where in the file system to put them. Was useful for Microsofts bing api, and splitting files out of composer to autoload.
View split_classes.php
<?php
# ini_set('memory_limit', '256M');
$directory = '/directory/where your php files are';
chdir($directory);
$files = glob($directory.'/*.php');
foreach($files as $file)
View nginx configuration.md

Create nginx conf for regular PHP sites

Create/Modify /etc/nginx/conf.d/php-fpm.conf

upstream php {
    #this should match value of "listen" directive in php-fpm pool
	server unix:/var/run/php5-fpm.sock;
#	server 127.0.0.1:9000;
@hackzilla
hackzilla / default.conf
Created Sep 6, 2012
Nginx Config for Symfony apps
View default.conf
server {
listen 80 default_server;
server_name _;
set $subdomain "default";
charset utf-8;
if ($host ~* "^(.+)\.(ukwm[0-9]{3}|local)$") {
set $subdomain $1;
You can’t perform that action at this time.