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
db.collection.find({ field : { $exists : true } }).forEach( function (x) { | |
var temp = {} | |
var count = 0 | |
for (var i in x.field) { | |
if (typeof x.field[i] == "string") { | |
// make sure index is a string | |
temp[x.field[i]] = x.date; | |
count++; | |
} |
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 os import fdopen, remove | |
from tempfile import mkstemp | |
# http://docs.python.org/2/library/tempfile.html#tempfile.mkstemp | |
fd, filename = mkstemp(prefix='example') | |
# note the usage of fdopen/fd instead of open/filename | |
with fdopen(fd, 'w') as f: | |
# do something with the file | |
pass |
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/bash | |
# script to install pcre on openshift | |
# this can be called in your action_hooks to setup pcre | |
# useful if you want to use regex in uwsgi, or nginx | |
# | |
# NOTE: | |
# If scaling, make sure you call this in your pre_start* hook, | |
# ${OPENSHIFT_DATA_DIR} is not copied over for a new gear |
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/bash -e | |
# This assumes that your openshift repo contains a uwsgi.ini | |
# configuration file. | |
# This is a extracted from a script used live for the victims project: | |
# https://github.com/victims/victims-server-openshift/blob/master/bin/control | |
source $OPENSHIFT_CARTRIDGE_SDK_BASH | |
# Setup globals |
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/bash | |
# Wrapper script interact with mongofiles | |
MONGOFILES_CMD="mongofiles \ | |
-u $OPENSHIFT_MONGODB_DB_USERNAME \ | |
-p $OPENSHIFT_MONGODB_DB_PASSWORD \ | |
-h $OPENSHIFT_MONGODB_DB_HOST \ | |
--port $OPENSHIFT_MONGODB_DB_PORT \ | |
-d $OPENSHIFT_APP_NAME" |
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
""" | |
An asynchronous task manager. | |
This is a simple implementation for background task handing. No guarentees are | |
provided for task execution. | |
This was developed in the course of the work don for the victims project and | |
that version is available at | |
https://github.com/victims/victims-web/blob/master/src/victims_web/handlers/task.py |
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 | |
# Hard-code credentials here, or better, pass them as env vars | |
USERNAME="${RELIANCE_USER}" | |
PASSWORD="${RELIANCE_PASS}" | |
# Reliance Broadband URLs | |
BASE_URL="http://reliancebroadband.co.in" | |
START_URL="${BASE_URL}/reliance/startportal_isg.do" | |
LOGIN_URL="${BASE_URL}/reliance/login.do" |
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
/** | |
* Licensed to the Apache Software Foundation (ASF) under one or more | |
* contributor license agreements. See the NOTICE file distributed with this | |
* work for additional information regarding copyright ownership. The ASF | |
* licenses this file to you under the Apache License, Version 2.0 (the | |
* "License"); you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.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
/** | |
* Licensed to the Apache Software Foundation (ASF) under one or more | |
* contributor license agreements. See the NOTICE file distributed with this | |
* work for additional information regarding copyright ownership. The ASF | |
* licenses this file to you under the Apache License, Version 2.0 (the | |
* "License"); you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.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 bash | |
if [ "$(whoami)" != "root" ]; then | |
echo "This script needs to be run as root." | |
exit 1 | |
fi | |
# Dependencues | |
yum install -y python git |
OlderNewer