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
| require 'formula' | |
| class Thrift < Formula | |
| homepage 'http://thrift.apache.org' | |
| # The thrift.apache.org 0.9.1 archive is missing PHP ext, fixed in THRIFT-2129 | |
| # By grapping the source from git instead, it's fixed, but we need to bootstrap | |
| url 'https://git-wip-us.apache.org/repos/asf/thrift.git', :branch => "0.9.1" | |
| version "0.9.1" | |
| head do |
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
| #!/usr/bin/env python | |
| # echo '{ "title": "Бумажки: простая игра на сегодняшний вечер / Блог компании Мосигра / Хабрахабр", "url": "http://habrahabr.ru/company/mosigra/blog/207906/" }' | python json2query.py | pbcopy | |
| # curl -d'url=http%3A%2F%2Fhabrahabr.ru%2Fcompany%2Fmosigra%2Fblog%2F207906%2F&title=%D0%91%D1%83%D0%BC%D0%B0%D0%B6%D0%BA%D0%B8%3A+%D0%BF%D1%80%D0%BE%D1%81%D1%82%D0%B0%D1%8F+%D0%B8%D0%B3%D1%80%D0%B0+%D0%BD%D0%B0+%D1%81%D0%B5%D0%B3%D0%BE%D0%B4%D0%BD%D1%8F%D1%88%D0%BD%D0%B8%D0%B9+%D0%B2%D0%B5%D1%87%D0%B5%D1%80+%2F+%D0%91%D0%BB%D0%BE%D0%B3+%D0%BA%D0%BE%D0%BC%D0%BF%D0%B0%D0%BD%D0%B8%D0%B8+%D0%9C%D0%BE%D1%81%D0%B8%D0%B3%D1%80%D0%B0+%2F+%D0%A5%D0%B0%D0%B1%D1%80%D0%B0%D1%85%D0%B0%D0%B1%D1%80' http://localhost:3333/page | |
| import sys | |
| import urllib | |
| import json | |
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
| 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 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
| <?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 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
| #!/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 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 | |
| # 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 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
| """ | |
| [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 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 | |
| # | |
| # supervisord This scripts turns supervisord on | |
| # | |
| # Author: Mike McGrath <[email protected]> (based off yumupdatesd) | |
| # Jason Koppe <[email protected]> adjusted to read sysconfig, | |
| # use supervisord tools to start/stop, conditionally wait | |
| # for child processes to shutdown, and startup later | |
| # Mikhail Mingalev <[email protected]> Merged | |
| # redhat-init-jkoppe and redhat-sysconfig-jkoppe, and |
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
| #!/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 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
| # 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 |