Skip to content

Instantly share code, notes, and snippets.

View gravyboat's full-sized avatar

Forrest gravyboat

View GitHub Profile
@maccman
maccman / app.py
Created August 8, 2012 23:30
Stripe Flask Example
import os
from flask import Flask, render_template, request
import stripe
stripe_keys = {
'secret_key': os.environ['SECRET_KEY'],
'publishable_key': os.environ['PUBLISHABLE_KEY']
}
stripe.api_key = stripe_keys['secret_key']
@UtahDave
UtahDave / saltsample_09252012_01
Created September 26, 2012 02:54 — forked from l2ol33rt/saltsample_09252012_01
Saltstack sample of using states and pillars for users
Here is a sample of how I am currently dealing with users.
Big thanks to uggedal! I used his user states as an example: https://github.com/uggedal/states
###
# How to create password hashes
###
python -c "import crypt; print crypt.crypt('password', '\$6\$SALTsalt\$')"
###
@aderowbotham
aderowbotham / purge-ban-domain-varnish.md
Last active May 24, 2022 19:55
Purge (ban) an entire domain in Varnish Cache 3

How to purge ('ban') an entire domain in Varnish Cache 3

#####EDIT: NB Ban is technically different from Purge. Banned objects remain in memory but banning is faster than purging. Read the Varnish 3 documentation here and here.

Purge may be a more appropriate action for your use-case; although the examples in the gist below work, it's not necessarily the best way of doing this.


#!/usr/bin/ruby
# Create display override file to force Mac OS X to use RGB mode for Display
# see http://embdev.net/topic/284710
require 'base64'
data=`ioreg -l -d0 -w 0 -r -c AppleDisplay`
edids=data.scan(/IODisplayEDID.*?<([a-z0-9]+)>/i).flatten
vendorids=data.scan(/DisplayVendorID.*?([0-9]+)/i).flatten
anonymous
anonymous / repo.cr.internal.sls
Created January 9, 2014 20:43
repo_cr_ots:
git.latest:
- name: ssh://git_user@server/usr/local/git/ots.git
- target: /var/www/ots
- rev: {{ revision }}
import logging
try:
import nacl.state
from nacl.auto import *
from nacl.run import run
HAS_NACL = True
except ImportError:
HAS_NACL = False
@rgbkrk
rgbkrk / logrip.md
Last active August 29, 2015 13:56
Ripping logs from salt minions

Need a rapid way of pulling your logs back using salt? With one config option in /etc/salt/master and two quick commands, you can do this in parallel across your boxes.

First, use archive.tar to tarball up your logs

salt '*' archive.tar cvzf /tmp/logs.tgz /var/log/

Next up, cp.push to pull the logs back from the minions up to the master

In order to use cp.push, you'll need to set file_recv to True within /etc/salt/master.

@kyledrake
kyledrake / ferengi-plan.txt
Last active April 6, 2024 00:30
How to throttle the FCC to dial up modem speeds on your website using Nginx
# The blog post that started it all: https://neocities.org/blog/the-fcc-is-now-rate-limited
#
# Current known FCC address ranges:
# https://news.ycombinator.com/item?id=7716915
#
# Confirm/locate FCC IP ranges with this: http://whois.arin.net/rest/net/NET-165-135-0-0-1/pft
#
# In your nginx.conf:
location / {
{% set a = 'world' %}
{% set b = 'hello-{test}' %}
test:
file.touch:
- name: /tmp/{{ b.format(test=a) }}
@UtahDave
UtahDave / top.sls
Created August 5, 2014 18:08
Auto include minion specific sls file
### top.sls (more tweaks)
dev:
'*':
- nodes.{{ grains['id' }}
base:
'*':
- nodes.{{ grains['id' }}