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://dev.mysql.com/get/Downloads/MySQL-5.6/MySQL-shared-compat-5.6.16-1.el6.x86_64.rpm | |
rpm -i MySQL-shared-compat-5.6.16-1.el6.x86_64.rpm | |
yum install php55w php55w-opcache |
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
<?php | |
// Headings and rows | |
$headings = array('ID', 'Name', 'Colour'); | |
$array = array( | |
array(1, 'Apple', 'Green'), | |
array(2, 'Banana', 'Yellow'), | |
array(3, 'Orange', 'Orange'), | |
); | |
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 | |
# unicode: utf-8 | |
from __future__ import print_function | |
from math import radians, sqrt, sin, cos, atan2 | |
import sys | |
def get_distance(point1, point2): | |
lat1, lon1 = point1.strip().split(',') |
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 | |
# Source: http://toomuchdata.com/2012/06/25/how-to-install-python-2-7-3-on-centos-6-2/ | |
yum groupinstall "Development tools" | |
yum install zlib-devel | |
yum install bzip2-devel openssl-devel ncurses-devel | |
wget http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tar.bz2 | |
tar xf Python-2.7.3.tar.bz2 | |
cd Python-2.7.3 |
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
""" | |
[pow(2, n) for n in xrange(10000)] | |
0.108330011368 sec | |
[p(2, n) for n in xrange(10000)] | |
0.289177894592 sec | |
[bp(2, n) for n in xrange(10000)] | |
19.3486168385 sec | |
""" |
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 | |
# | |
# supervisord This scripts turns supervisord on | |
# | |
# Author: Mike McGrath <mmcgrath@redhat.com> (based off yumupdatesd) | |
# Jason Koppe <jkoppe@indeed.com> adjusted to read sysconfig, | |
# use supervisord tools to start/stop, conditionally wait | |
# for child processes to shutdown, and startup later | |
# Mikhail Mingalev <mingalevme@gmail.com> Merged | |
# redhat-init-jkoppe and redhat-sysconfig-jkoppe, and |
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 | |
from __future__ import print_function | |
import time | |
def profile(f): | |
def wrapper(*arg): | |
start = time.time() | |
f(*arg) |
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
# http://en.wikipedia.org/wiki/Blood_alcohol_content | |
# BAC Chart Values | |
# 0.00 – 0.03% Normal behavior, no impairme nt | |
# 0.03 – 0.06% Mild euphoria and impairment; decreased inhibitions | |
# 0.06 – 0.10% Buzzed, euphoric, increased impairment | |
# 0.10 – 0.20% Drunk, emotional swings, slurred speech, nausea, loss of reaction time and motor control | |
# 0.20 – 0.30% Confused, nauseated, poor mentation, black out | |
# 0.30 – 0.40% Possibly unconscious, unarrousable, loss of bladder function, risk of death | |
# Above 0.40% Unconscious, coma, impaired breathi ng, risk of death |
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
<script type="text/javascript"> | |
$(function(){ | |
$('input#submit').click(function(){ | |
var file = $('input[type="file"]').val(); | |
var exts = ['doc','docx','rtf','odt']; | |
// first check if file field has any value | |
if ( file ) { | |
// split file name at dot | |
var get_ext = file.split('.'); | |
// reverse name to check extension |
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 re | |
def fff(url): | |
query = re.search('\?(.*)', url) | |
return query and query.group() or '/' | |
def fff2(url): | |
query = re.search('(https?://)?\w/(.*)', url) | |
return "/%s" % (query and query.group(2) or "", ) |
OlderNewer