This file contains hidden or 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 | |
# Backs up the OpenShift PostgreSQL database for this application | |
# by Skye Book <[email protected]> | |
NOW="$(date +"%Y-%m-%d")" | |
FILENAME="$OPENSHIFT_DATA_DIR/$OPENSHIFT_APP_NAME.$NOW.backup.sql.gz" | |
find $OPENSHIFT_DATA_DIR -name $OPENSHIFT_APP_NAME.*backup* -type f -mtime +30 -exec rm '{}' \; | |
pg_dump $OPENSHIFT_APP_NAME | gzip > $FILENAME | |
This file contains hidden or 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
##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### | |
### Shell script to download Oracle JDK / JRE / Java binaries from Oracle website using terminal / command / shell prompt using wget. | |
### You can download all the binaries one-shot by just giving the BASE_URL. | |
### Script might be useful if you need Oracle JDK on Amazon EC2 env. | |
### Script is updated for every JDK release. | |
### Features:- | |
# 1. Resumes a broken / interrupted [previous] download, if any. | |
# 2. Renames the file to a proper name with including platform info. |
This file contains hidden or 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 plone.dexterity.utils import createContentInContainer | |
from plone.namedfile.file import NamedBlobFile | |
import transaction | |
def Builder(name): | |
if name == "dossier": | |
return DossierBuilder(BuilderSession.instance()) | |
elif name == "document": | |
return DocumentBuilder(BuilderSession.instance()) | |
elif name == "task": |
This file contains hidden or 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
# Quick-and-Dirty Brute Force Risk vs Reward bot | |
# Before each roll (except the first), do a brute force calculation of risk vs reward. In this case, | |
# risk is the probability of having 3 shotgun dice after the roll, and reward is the probability of | |
# getting an extra 1, 2, or 3 brains. If P(death) - rewardBonus[1]*P(1 brain) - | |
# rewardBonus[2]*P(2 brain) - rewardBonus[3]*P(3 brain) > rvrCutoff, then roll. | |
# If behindBonus and/or aheadPenalty are not zero, then those amounts are added to or subtracted from | |
# the risk vs reward depending on weather the bot is winning or losing, encouraging risky play when | |
# behind and safer play when ahead |
create different ssh key according the article Mac Set-Up Git
$ ssh-keygen -t rsa -C "[email protected]"
This file contains hidden or 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
#Model | |
@user.should have(1).error_on(:username) # Checks whether there is an error in username | |
@user.errors[:username].should include("can't be blank") # check for the error message | |
#Rendering | |
response.should render_template(:index) | |
#Redirecting | |
response.should redirect_to(movies_path) |
This file contains hidden or 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 selenium.common.exceptions import NoSuchElementException, TimeoutException | |
class DomHelper(object): | |
driver = None | |
waiter = None | |
def open_page(self, url): | |
self.driver.get(url) |
This file contains hidden or 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
var http = require('http'), | |
Url = require('url'), | |
htmlparser = require('node-htmlparser'), | |
dom = require('jsdom/level1/core').dom.level1.core, | |
index = require('jsdom/browser/index'), | |
sizzleInit = require('sizzle').sizzleInit; | |
// Simple wrapper around node's http client, htmlparser, jsdom, and sizzle | |
function fetch(url, callback) { | |
var uri = Url.parse(url); |