Skip to content

Instantly share code, notes, and snippets.

View BanzaiMan's full-sized avatar

Hiro Asari BanzaiMan

View GitHub Profile
require 'ostruct'
job = OpenStruct.new( :state => 'failed')
def debug_data
{
previous_state: job.state
}
end
@BanzaiMan
BanzaiMan / gist:8a8202115116c4fac00c
Created February 28, 2016 19:22
pip lies to me.
$ pip install --user --upgrade pip
You are using pip version 6.0.8, however version 8.0.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting pip from https://pypi.python.org/packages/py2.py3/p/pip/pip-8.0.3-py2.py3-none-any.whl#md5=b234250205337ff67967dff300001e3d
Downloading pip-8.0.3-py2.py3-none-any.whl (1.2MB)
100% |################################| 1.2MB 419kB/s
Installing collected packages: pip
Successfully installed pip-6.0.8
[
{
"url": "https://api.github.com/repos/travis-ci/travis-api/issues/comments/75100791",
"html_url": "https://github.com/travis-ci/travis-api/issues/162#issuecomment-75100791",
"issue_url": "https://api.github.com/repos/travis-ci/travis-api/issues/162",
"id": 75100791,
"user": {
"login": "BanzaiMan",
"id": 25666,
@BanzaiMan
BanzaiMan / how-to-lie-with-statistics-notes.md
Last active January 4, 2016 00:38
How to Lie with Statistics (a 2-minute digest)

Synopsis

  1. Some samples have implicit bias. Watch out for them. (For example, surveys represent only the respondents. Stratified samples are hard to get.)
  2. "Average" can mean a lot of things. Arithmetic mean (weighted or not), median, or mode? When unspecified, you can assume that the writer put down the number that best advances their agenda.
  3. Data obtained from small samples can be used to make extravagant claims because they can exhibit erratic characteristics.
  4. When a statistic is about a range (e.g., IQ test scores), the differences in similar scores are not significant. More important is to compare confidence intervals.
  5. Graphs can be deceiving. (e.g., line graphs may not start at 0 on the y-axis, or be skewed to make the variance in values more significant.)
  6. Embelishing graphics to show quantities can be deceiving. (e.g., the area can square the significance--1 vs 1.5^2, or 3-d graphics can cube--1 vs 1.5^3)
  7. Unrelated claims can accompany honest-to-goodness statistics to insinuate unc
@BanzaiMan
BanzaiMan / .travis.yml
Created September 25, 2015 15:44
Matrix trick for Elixir 1.2 & 1.x
language: elixir
elixir:
- 1.0.5
otp_release: 17.3
matrix:
include:
- elixir: 1.2

Database setup

  1. First, clone travis-ci into the same directory as travis-api:

    $ git clone https://github.com/travis-ci/travis-api.git
    
  2. Next, creat symbolic link travis-api/db pointing to travis-core/db:

$ pry
[1] pry(main)> /(\w+):?(\w*)/.match("one.two")
=> #<MatchData "one" 1:"one" 2:"">
[2] pry(main)> "one.two".scan /(\w+):?(\w*)/
=> [["one", ""], ["two", ""]]
WITH RECURSIVE
x(i) AS ( VALUES (0)
UNION ALL SELECT i + 1
FROM x
WHERE i < 101),
Z(Ix, Iy, Cx, Cy, X, Y, I) AS (
SELECT Ix, Iy, X :: FLOAT, Y :: FLOAT, X :: FLOAT, Y :: FLOAT, 0
FROM
(SELECT -2.2 + 0.031 * i, i
FROM x) AS xgen(x, ix) CROSS JOIN
>> req.payload
=> {"action"=>"synchronize",
"number"=>20902,
"pull_request"=>
{"url"=>"https://api.github.com/repos/rails/rails/pulls/20902",
"id"=>40140550,
"html_url"=>"https://github.com/rails/rails/pull/20902",
"diff_url"=>"https://github.com/rails/rails/pull/20902.diff",
"patch_url"=>"https://github.com/rails/rails/pull/20902.patch",
"issue_url"=>"https://api.github.com/repos/rails/rails/issues/20902",
[
{
"url": "https://api.github.com/repos/travis-ci/casher/issues/comments/52886423",
"html_url": "https://github.com/travis-ci/casher/issues/6#issuecomment-52886423",
"issue_url": "https://api.github.com/repos/travis-ci/casher/issues/6",
"id": 52886423,
"user": {
"login": "rkh",
"id": 30442,