Skip to content

Instantly share code, notes, and snippets.

@kojiwell
kojiwell / deploy_salt.yml
Last active November 6, 2023 02:08
OpenStack Heat template example: Deploy Salt Cluster with HOT
heat_template_version: 2013-05-23
description: Deploy Salt Cluster
parameters:
keyname:
type: string
description: Key name for loggin in to instances
imagename:
type: string
@fyears
fyears / note.md
Last active February 6, 2024 09:59
how to install scipy numpy matplotlib ipython in virtualenv

if you are using linux, unix, os x:

pip install -U setuptools
pip install -U pip

pip install numpy
pip install scipy
pip install matplotlib
#pip install PySide
@plentz
plentz / nginx.conf
Last active September 25, 2025 09:04
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@alanhamlett
alanhamlett / api.py
Last active October 21, 2024 14:30
Serialize SQLAlchemy Model to dictionary (for JSON output) and update Model from dictionary attributes.
import uuid
import wtforms_json
from sqlalchemy import not_
from sqlalchemy.dialects.postgresql import UUID
from wtforms import Form
from wtforms.fields import FormField, FieldList
from wtforms.validators import Length
from flask import current_app as app
from flask import request, json, jsonify, abort
@ifnull
ifnull / gist:5761255
Last active October 26, 2020 00:20
git add alias for git annex that excludes selected file extensions from master and adds them to annex.
#######################
# Setup
#######################
mkdir annex-test
cd annex-test
git init
git annex init master
#######################
# Fab setup task
@MatthewCallis
MatthewCallis / iframed.js
Last active December 16, 2015 09:49
Am I in an iFrame? Am I Visible?
var _gaq = _gaq || [];
(function(win, depth){
var iframe = false;
if(win){
if(
win.location !== win.parent.location ||
win.self !== win.top ||
(win.self.frameElement && (win.self.frameElement+"").indexOf("HTMLIFrameElement") > -1)
){
@MatthewCallis
MatthewCallis / bs.as
Last active December 16, 2015 06:28
Detect and record the actual version of Adobe Flash of a visitor.
package com.hark
{
import flash.system.*;
import flash.display.MovieClip;
import flash.external.ExternalInterface;
import flash.events.Event;
import flash.events.SecurityErrorEvent;
public class bs extends MovieClip {
// Allow insecure access so anyone can embed it.
@markpundsack
markpundsack / heroku-CVE-2013-0156.rb
Last active November 27, 2023 15:44 — forked from elliottkember/heroku-CVE-2013-0156.rb
Forked from https://gist.github.com/4489689 by elliottkember. CVE-2013-0156 is a nasty vulnerability in many versions of Rails. This script checks all your Heroku apps for this vulnerability in one quick (slow) move. More info: https://groups.google.com/forum/#!topic/rubyonrails-security/61bkgvnSGTQ/discussion
## The quick-and-nasty CVE-2013-0156 Heroku inspector!
## Originally brought to you by @elliottkember with changes by @markpundsack @ Heroku
## Download and run using:
## ruby heroku-CVE-2013-0156.rb
`heroku list`.split("\n").each do |app|
app = app.strip
# Some "heroku apps" lines have === formatting for grouping. They're not apps.
next if app[0..2] == "==="
@aaronjensen
aaronjensen / edit_data_bag.rb
Created November 21, 2012 04:39
Edit encrypted data bags for use with chef-solo and knife-solo
#!/usr/bin/env ruby
Dir.chdir File.join(__FILE__, "../..")
unless ENV['EDITOR']
puts "No EDITOR found. Try:"
puts "export EDITOR=vim"
exit 1
end
unless ARGV.count == 2
@maximebf
maximebf / gist:3986659
Created October 31, 2012 11:56
Jinja2 macro to render WTForms fields with Twitter Bootstrap
{% macro form_field(field) -%}
{% set with_label = kwargs.pop('with_label', False) %}
{% set placeholder = '' %}
{% if not with_label %}
{% set placeholder = field.label.text %}
{% endif %}
<div class="control-group {% if field.errors %}error{% endif %}">
{% if with_label %}
<label for="{{ field.id }}" class="control-label">
{{ field.label.text }}{% if field.flags.required %} *{% endif %}: