This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!/usr/bin/env bash | |
# Pre-requisites | |
sudo apt-get -y update | |
sudo apt-get --no-install-recommends -y install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev libgdbm-dev ncurses-dev automake libtool bison pkg-config libffi-dev vim python2.7 python-dev | |
# Add SaltStack repository | |
# sudo add-apt-repository ppa:saltstack/salt | |
echo deb http://ppa.launchpad.net/saltstack/salt/ubuntu `lsb_release -sc` main | sudo tee /etc/apt/sources.list.d/saltstack.list | |
wget -q -O- "http://keyserver.ubuntu.com:11371/pks/lookup?op=get&search=0x4759FA960E27C0A6" | sudo apt-key add - |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wget http://downloads.sourceforge.net/project/opencvlibrary/opencv-unix/2.4.9/opencv-2.4.9.zip | |
unzip opencv-2.4.9 | |
cd opencv-2.4.9 | |
mkdir build | |
cd build | |
export PYTHON_EXECUTABLE=$(readlink -e $(which python)) | |
export PYTHON_INCLUDE_DIR=${PYTHON_EXECUTABLE%/*/*}/include | |
export PYTHON_LIBRARY=${PYTHON_EXECUTABLE%/*/*}/lib/libpython2.7.a | |
export PYTHON_NUMPY_INCLUDE_DIR=${PYTHON_EXECUTABLE%/*/*}/lib/python2.7/site-packages/numpy/core/include/numpy | |
export PYTHON_PACKAGES_PATH=${PYTHON_EXECUTABLE%/*/*}/lib/python2.7/site-packages |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
These are the possible causes: | |
There may be a syntax error in the application's code. Please check for such errors and fix them. | |
A required library may not installed. Please install all libraries that this application requires. | |
The application may not be properly configured. Please check whether all configuration files are written correctly, fix any incorrect configurations, and restart this application. | |
A service that the application relies on (such as the database server or the Ferret search engine server) may not have been started. Please start that service. | |
Further information about the error may have been written to the application's log file. Please check it in order to analyse the problem. | |
Error message: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask, make_response | |
app = Flask(__name__) | |
@app.route("/simple.png") | |
def simple(): | |
import datetime | |
import StringIO | |
import random | |
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datetime import datetime | |
import time | |
from struct import unpack, pack | |
datetime.fromtimestamp(float(unpack("Q",pack("Q",float(datetime.now().strftime('%s.%f')) * 1000))[0]) / 1000), datetime.now() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
IAM boto examples: | |
In this example we create a group that provides access | |
to all EC2 and S3 resources and actions and then add a | |
user to that group. | |
""" | |
import boto | |
# | |
# First create a connection to the IAM service |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
### BEGIN INIT INFO | |
# Provides: supervisord | |
# Required-Start: $remote_fs | |
# Required-Stop: $remote_fs | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: Example initscript | |
# Description: This file should be used to construct scripts to be | |
# placed in /etc/init.d. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# /etc/rc.d/init.d/supervisord | |
# | |
# Supervisor is a client/server system that | |
# allows its users to monitor and control a | |
# number of processes on UNIX-like operating | |
# systems. | |
# | |
# chkconfig: - 64 36 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import mmap | |
from time import sleep | |
with open('cmd.txt', 'r+b') as f: | |
m = mmap.mmap(f.fileno(), 0) | |
while True: | |
data = m.readline() | |
print data | |
sleep(0.5) | |
m.seek(0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import requests | |
import kerberos | |
class KerberosTicket: | |
def __init__(self, service): | |
__, krb_context = kerberos.authGSSClientInit(service) | |
kerberos.authGSSClientStep(krb_context, "") | |
self._krb_context = krb_context | |
self.auth_header = ("Negotiate " + |
OlderNewer