Skip to content

Instantly share code, notes, and snippets.

View philcryer's full-sized avatar
💭
Mostly harmless

Phil Cryer philcryer

💭
Mostly harmless
View GitHub Profile
@philcryer
philcryer / coreid.sh
Last active April 19, 2017 07:00
Get the Amazon CoreOS AMI ID and URL
#!/bin/bash
build=alpha # define build ["stable", "beta", "alpha"]
disk=hvm # define disk backing ["pv", "hvm"]
if [ "x$1" = "x" ]; then
echo "Usage: $0 REGION"; exit 1
fi
#### deprecated
@philcryer
philcryer / gist:c27214b11d3cbd8d647a
Created May 6, 2015 03:16
Dockerfile for awscli based on a minimal Debian 8 (jessie) build (131.4 MB)
FROM philcryer/min-jessie:latest
MAINTAINER Phil Cryer <[email protected]>
RUN apt-get update \
&& apt-get install -yq --no-install-recommends python-pip \
&& pip install awscli \
&& apt-get clean -y \
&& apt-get autoclean -y \
&& apt-get autoremove -y \
&& rm -rf /usr/share/locale/* \
@philcryer
philcryer / gist:3bbce14263d7715df3f1
Created May 4, 2015 15:48
gist of templae - cloud-config
"UserData": {
"Fn::Base64": {
"Fn::Join": [
"",
[
"#cloud-config\n\ncoreos:\n etcd:\n addr: $",
{
"Ref": "AdvertisedIPAddress"
},
"_ipv4:4001\n peer-addr: $",
@philcryer
philcryer / ann
Last active August 29, 2015 14:19
It's ann, which *ann*ihilates Docker, featuring Ann B. Davis as Alice (she played a maid, maids clean things)
#!/bin/bash
set -e
# oneshot
# gist_id="b213be6ac41505912875"; curl -s -k -o tmp https://gist.github.com/philcryer/$gist_id/download; tar -xf tmp; mv gist$gist_id-*/ann .; rm -rf gist$gist_id-* tmp; chmod a+x ann
ann-usage(){
cat <<EOM
Usage: ann
@philcryer
philcryer / gist:7948608b0bdc5a084dfa
Created April 13, 2015 14:43
Looking at security headers of presidential hopefuls of 2016
idea inspired by: https://paulschreiber.com/blog/2015/04/12/presidential-candidate-website-tech-compared/
scanning and details provided by https://securityheaders.com/test-http-headers.php
hillaryclinton.com Header Analysis
The HTTP headers we saw when we visited hillaryclinton.com...
HTTP/1.1 302 Moved Temporarily
Content-Length: 154
Content-Type: text/html
@philcryer
philcryer / gist:98ccc98f76d0c39403a4
Last active August 29, 2015 14:18
haproxy - deny connection from domain, but not if from this IP
global
log 127.0.0.1 syslog info
daemon
user haproxy
group haproxy
maxconn 64000
spread-checks 4
tune.ssl.default-dh-param 2048
defaults
@philcryer
philcryer / sshd_config
Created March 23, 2015 21:26
sshd configuration exercise, on going, not ready for use (yet).
#### sshd_config (/etc/sshd/sshd_config)
#### philcryer/secure-sshd
#### 2015-03-23 / mit licensed
#### after any changes, test with
#### /usr/sbin/sshd -t -k sshd_config
# Ports (move from default to protect against drivebys)
Port 22122
# ???
@philcryer
philcryer / run.sh
Last active August 29, 2015 14:16
A logstash-forwarder script that does a docker build, creates new certs, names the container from the working dir, finds the correct image name and does a docker run on it.
#!/bin/bash
if [ ! $1 ]; then
echo "! fail - no logdestination at $1 - need hostname:port of log server"; exit 1
fi
if [ ! -f Dockerfile ]; then
echo "! fail - no Dockerfile file found"; exit 1
fi
@philcryer
philcryer / wpk_list
Created February 15, 2015 19:09
WPK Central Committee and Central Military Commission Publish Joint Slogans
# "WPK Central Committee and Central Military Commission Publish Joint Slogans"
# taken from http://kcnawatch.nknews.org/article/e2o1
# possibly useful for future slogans
# 2015/02/15
Let us all turn out in the general offensive to hasten final victory in the revolutionary spirit of Paektu!
Let us greet the 70th anniversaries of national liberation and Party founding with high political enthusiasm and brilliant labour feats!
Let us glorify the 70th anniversaries of national liberation and Party founding as revolutionary, auspicious events noteworthy in the history of Kim Il Sung's nation and Kim Jong Il's Korea!
#!/bin/bash
# tally the votes each canidate recieved in the election
in=/tmp/2012_GENERAL.txt
out=/tmp/2012_GENERAL-results.txt
if [ ! -f "${in}" ]; then
echo -n "> Downloading file..."
curl -s http://www.analyzethevote.com/download/2012_GENERAL.txt -o $in