Skip to content

Instantly share code, notes, and snippets.

@montanaflynn
montanaflynn / proxy.go
Last active January 17, 2021 15:37
Golang reverse proxy
package main
import (
"log"
"net/http"
"net/http/httputil"
)
func main() {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
@bsima
bsima / boot-project.clj
Last active August 29, 2015 14:10
Sometimes you want to use boot as a scripting platform on top of Leinengen. Paste this code at the top of your build.boot file. It reads in the project.clj file and stores it as a map named "project" which you can then use with `set-env!` to setup your environment.
(set-env! :dependencies '[[leiningen-core "2.5.0"]])
(use 'leiningen.core.project)
(eval (read-string (slurp "project.clj")))
(set-env!
:source-paths (:source-paths project)
:resource-paths (:resource-paths project)
:dependencies (:dependencies project))
@digital-wonderland
digital-wonderland / README.md
Last active April 6, 2022 17:22
Unit files to deploy an ElasticSearch cluster on CoreOS via Fleet

What

Unit files to deploy an ElasticSearch cluster on CoreOS via Fleet.

Service discovery & registration is done via etcd.

[email protected] provides a dumb discovery service by registering an elasticsearch host if it should be up. [email protected] registers the service only if it is running.

A service & timer unit for elasticsearch curator is provided which does some housekeeping.

@proppy
proppy / Dockerfile
Last active August 29, 2015 14:07
fig2kube
FROM google/python:2.7
ADD requirements.txt /code/requirements.txt
RUN pip install -r /code/requirements.txt
ADD . /code
WORKDIR /code
ENTRYPOINT ["python", "app.py"]
@pablitoc
pablitoc / configure_proxy_protocol.md
Last active April 12, 2023 15:21
Configuring Proxy Protocol

##Install AWS CLI Tools##

  1. Install AWS CLI Tools. You can also use the EC2 API Tool if you are more comfortable with them. But this write-up uses the EC2 CLI.
  2. Create a user via Amazon IAM or download the security accessID and securitykey you will need it to query Amazon CLI.
  3. using Terminal cd into .aws directory cd ~/.aws edit or create new file named config paste the following contents inside.
    `[default]`
    `aws_access_key_id = ACCESS_ID`
    `aws_secret_access_key = SECRET_ID`
    `output = json OR bson OR text`
    `region = PREFERRED_AWS_REGION`

Save the file as "config"

@rhuss
rhuss / docker-enter.sh
Last active August 29, 2015 14:05
nsenter with boot2docker
#!/bin/sh
usage ()
{
cat <<EOF
docker-enter -- Enter a running container via boot2docker and nsenter
Usage: docker-enter <container_name_or_ID> [command]
See https://github.com/jpetazzo/nsenter for details.
@dwwoelfel
dwwoelfel / utils.clj
Created August 1, 2014 06:31
Hack to get something approximating paint rectangles with React/om. Has very rough edges!
(defmacro html [body]
`(if-not (:render-colors? initial-query-map)
(html/html ~body)
(let [body# ~body]
(try
(let [[tag# & rest#] body#
attrs# (if (map? (first rest#))
(first rest#)
{})
rest# (if (map? (first rest#))
@adamalex
adamalex / CoreOScron.md
Last active August 29, 2015 14:03
CoreOS units for cron-like behavior
  1. fleetctl load *
  2. fleetctl start *.timer
@richp10
richp10 / gist:1c367d3c67aec762788e
Created May 10, 2014 10:19
Secure iptables configuration for coreos ??
// This systemd runs iptables-restore on boot:
[Unit]
Description=Packet Filtering Framework
DefaultDependencies=no
After=systemd-sysctl.service
Before=sysinit.target
[Service]
Type=oneshot
ExecStart=/usr/sbin/iptables-restore /opt/docker/scripts/iptables/iptables.rules
@geraldodev
geraldodev / gist:8855252
Created February 7, 2014 00:21
edit-buttons
(defn edit-buttons [_ _ {:keys [ch>]}]
(reify
om/IRender
(render [_]
(dom/div #js {:className "form-group btn-group"
:style (js-margin-right)}
(dom/button #js {:className "btn btn-default"
:onClick (fn [e]
(.preventDefault e)
(put! ch> {:event e