Skip to content

Instantly share code, notes, and snippets.

@DavidWittman
DavidWittman / saltstack-devstack.md
Last active November 21, 2024 09:26
Automated DevStack deployments on Rackspace with salt-cloud

Automated DevStack deployments on Rackspace with salt-cloud

Preparation

Install salt-master and salt-cloud

These instructions will install salt-master and salt-cloud on recent Ubuntu releases. Consult the SaltStack Installation Documentation should you require instructions for other distributions.

echo deb http://ppa.launchpad.net/saltstack/salt/ubuntu `lsb_release -sc` main | sudo tee /etc/apt/sources.list.d/saltstack.list
@kroger
kroger / mobi.py
Created June 26, 2013 11:37
Mobi builder based on Sphinx's epub builder.
# -*- coding: utf-8 -*-
"""
sphinx.builders.mobi
~~~~~~~~~~~~~~~~~~~~
Build mobi files.
Originally derived from epub.py.
:copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
@minrk
minrk / nbstripout
Last active March 12, 2025 18:41
git pre-commit hook for stripping output from IPython notebooks
#!/usr/bin/env python
"""strip outputs from an IPython Notebook
Opens a notebook, strips its output, and writes the outputless version to the original file.
Useful mainly as a git filter or pre-commit hook for users who don't want to track output in VCS.
This does mostly the same thing as the `Clear All Output` command in the notebook UI.
LICENSE: Public Domain
@hrj
hrj / calib.sh
Created September 14, 2013 11:28
Script to add red tint to the entire screen.
#!/bin/bash
# Call with a percentage value from 0 to 100
# 0 means only red, 50 means half of green and blue is shown through
# if you don't give any arguments the calibration is cleared
if [[ -z "$1" ]]; then
echo Clearing all calibrations
xcalib -clear
else
@niklasl
niklasl / schemaorg_to_jsonldcontext.py
Last active December 30, 2015 19:19
Generates a JSON-LD Context for Schema.org.
from rdflib import *
SDO = Namespace("http://schema.org/")
datatype_coerce_map = {
#SDO.Number: XSD.double,
SDO.Date: 'xsd:date',
SDO.DateTime: "xsd:dateTime",
}
@lemiorhan
lemiorhan / post-receive
Last active April 12, 2025 19:13
Post-receive hook to deploy the code being pushed to production branch to a specific folder
#!/bin/bash
target_branch="production"
working_tree="PATH_TO_DEPLOY"
while read oldrev newrev refname
do
branch=$(git rev-parse --symbolic --abbrev-ref $refname)
if [ -n "$branch" ] && [ "$target_branch" == "$branch" ]; then
@westurner
westurner / broadband_cap.py
Last active August 29, 2015 13:57
Calculate time to reach broadband cap with specified bandwidth speeds
#!/usr/bin/env python
# encoding: utf-8
from __future__ import print_function
from __future__ import division
"""
broadband_cap
==============
Calculate time to reach broadband cap with specified bandwidth speeds
Usage::
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@westurner
westurner / cinst_workstation_minimal.ps1
Last active March 2, 2021 11:08
PowerShell script to install a minimal Workstation with Chocolatey
### PowerShell script to install a minimal Workstation with Chocolatey
# https://chocolatey.org
## To Run This Script:
# 1. Download this PowerShell script
# * Right-click <> ("View Raw") and "Save As" to %USERPROFILE% (/Users/<username>)
# * If Cocolatey is not already installed, see
# "Uncomment to install Chocolatey"
# * If you would like to also install Anaconda
# (Python, IPython, lots of great libraries)
@onyxfish
onyxfish / ordered_json.py
Created May 29, 2014 17:25
Usage of object_pairs_hook to load JSON with guaranteed key order
#!/usr/bin/env python
from collections import OrderedDict
import json
write_data = OrderedDict([
('a', '1'),
('b', '2'),
('c', '3')
])