Skip to content

Instantly share code, notes, and snippets.

@hackzilla
hackzilla / cloud-config
Last active August 29, 2015 14:06
etcd + fleet, 3 node clust
#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
#cloud-config
hostname: {{ name }}
write_files:
- path: /etc/environment
permissions: 0644
content: |
COREOS_PUBLIC_IPV4={{ public_ip }}
COREOS_PRIVATE_IPV4={{ private_ip }}
@hackzilla
hackzilla / user_data
Last active August 29, 2015 14:05
CoreOS
#!/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 July 10, 2014 09:44
CoreOS fails to switch channel from BETA to ALPHA
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

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 December 11, 2013 15:29
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.
<?php
# ini_set('memory_limit', '256M');
$directory = '/directory/where your php files are';
chdir($directory);
$files = glob($directory.'/*.php');
foreach($files as $file)
@hackzilla
hackzilla / nginx configuration.md
Last active October 16, 2016 12:08
Nginx configuration - inspired from https://gist.github.com/ogrrd/5824274

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 September 6, 2012 10:21
Nginx Config for Symfony apps
server {
listen 80 default_server;
server_name _;
set $subdomain "default";
charset utf-8;
if ($host ~* "^(.+)\.(ukwm[0-9]{3}|local)$") {
set $subdomain $1;