Instantly share code, notes, and snippets.

View .rubocop.yml
# Based off:
- 'bin/**/*'
- 'db/**/*'
- 'config/**/*'
- 'script/**/*'
- 'Guardfile'
- !ruby/regexp /old_and_unused\.rb$/
TargetRubyVersion: 2.5
View redirect.php
* Redirect the user to another, existing, wiki page.
* Save to actions/redirect/redirect.php
* ACL for the page have precedence, therefore the user will not be redirected
* if he is not allowed to see the page. The redirect only occurs if the method is 'show'.
* Append 'redirect=no' as a param to the page URL to be not redirected.
# -*- coding: utf-8 -*-
URL Detection
I'm looking for a roughly accurate URL counter for spam detection in user-submitted content.
import re
View migrateDeprecatedLinks.php

This test example is based on the Google App Engine docs and Flask docs.

To run test:

python tests/ ~/google-cloud-sdk/platform/google_appengine/

~/google-cloud-sdk/platform/google_appengine/ is the path to the App Engine SDK.

# Simple Scraper for Dow Jones Industrial Average
# With Python 3
# INSTALLATION (with pyenv)
# pyenv local 3.4.1
# pip install requests
# pip install beautifulsoup4
# pip install

From a comment by aws17576 on MetaFilter:

By the way, I wholeheartedly endorse Persi Diaconis's comment that probability is one area where even experts can easily be fooled. This was demonstrated to me in grad school when my advisor, addressing a roomful of mathematicians, posed this problem:

Person A flips a coin repeatedly, stopping the first time two heads in a row appear. Person B flips a coin repeatedly, stopping the first time a head and then a tail appear in a row. Who will flip the coin more times on average -- A, B, or is there no difference?

He let everyone think for a moment, then took a show of hands. Almost everyone got it wrong.

import random
from math import sqrt
from trueskill import TrueSkill, Rating, quality_1vs1, rate_1vs1, BETA
from trueskill.backends import cdf
# From
def win_probability(team_rating, opponent_rating):
delta_mu = -
denom = sqrt(2 * (BETA * BETA) + pow(team_rating.sigma, 2) + pow(opponent_rating.sigma, 2))
win_prob = cdf(delta_mu / denom)
View websphere.yml
# This playbook assumes the WebSphere MQ file provided by IBM has already been
# downloaded to a specific directory (target.wd) on the server.
# ${target.wd} is a variable representing the working directory on the target
# server the MQ client will be installed.
# Note: Although this playbook is designed to be able to be run independently,
# it is in fact part of a longer playbook and therefore may have some other
# unexpected dependencies not reflected here.
# Natural Language Date Parsing
import parsedatetime as pdt
from datetime import datetime, date, timedelta
from time import mktime
import pdb