| import hashlib as hasher | |
| import datetime as date | |
| # Define what a Snakecoin block is | |
| class Block: | |
| def __init__(self, index, timestamp, data, previous_hash): | |
| self.index = index | |
| self.timestamp = timestamp | |
| self.data = data | |
| self.previous_hash = previous_hash |
First, make sure you have command line tools installed:
xcode-select --installThen open Terminal.app and type:
curl https://gist.githubusercontent.com/DirtyF/5d2bde5c682101b7b5d90708ad333bf3/raw/fbc736fa1b50bd637929a315e6803df306c8bc8e/setup-rbenv.sh | bashCode is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.
- Follow standard conventions.
- Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
- Boy scout rule. Leave the campground cleaner than you found it.
- Always find root cause. Always look for the root cause of a problem.
| PostgreSQL Data Types | AWS DMS Data Types | Redshift Data Types | |
|---|---|---|---|
| INTEGER | INT4 | INT4 | |
| SMALLINT | INT2 | INT2 | |
| BIGINT | INT8 | INT8 | |
| NUMERIC (p,s) | If precision is 39 or greater, then use STRING. | If the scale is => 0 and =< 37 then: NUMERIC (p,s) If the scale is => 38 and =< 127 then: VARCHAR (Length) | |
| DECIMAL(P,S) | If precision is 39 or greater, then use STRING. | If the scale is => 0 and =< 37 then: NUMERIC (p,s) If the scale is => 38 and =< 127 then: VARCHAR (Length) | |
| REAL | REAL4 | FLOAT4 | |
| DOUBLE | REAL8 | FLOAT8 | |
| SMALLSERIAL | INT2 | INT2 | |
| SERIAL | INT4 | INT4 |
| import numpy as np | |
| import scipy | |
| import time | |
| import matplotlib.pyplot as plt | |
| print np.__file__ | |
| ax = plt.subplot(111) |
The Transmission torrent client has an option to set a Blocklist, which helps protect you from getting caught and having the DMCA send a letter/email.
It's as simple as downloading and installing the latest client:
| import pymc, pymc.graph | |
| import matplotlib.pyplot as plt | |
| import numpy as np | |
| import sys | |
| channels = [ | |
| ('A', 2292.04, 9), | |
| ('B', 1276.85, 2), | |
| ('C', 139.59, 3), | |
| ('D', 954.98, 5) |
distinct column -> For each row returned, return only the unique members of a set.
Think of it as for each row in a projection, concatenate all the column values and return only the strings that are unique.
test_db=# SELECT DISTINCT parent_id, child_id, id FROM test.foo_table ORDER BY parent_id, child_id, id LIMIT 10;
parent_id | child_id | id
-----------+------------+-----------------------------
1000040 | 103 | 1000040|2645405726|0001|103
| import pandas as pd | |
| # http://blog.yhathq.com/static/misc/data/WineKMC.xlsx | |
| df_offers = pd.read_excel("./WineKMC.xlsx", sheetname=0) | |
| df_offers.columns = ["offer_id", "campaign", "varietal", "min_qty", "discount", "origin", "past_peak"] | |
| df_offers.head() | |
| df_transactions = pd.read_excel("./WineKMC.xlsx", sheetname=1) | |
| df_transactions.columns = ["customer_name", "offer_id"] | |
| df_transactions['n'] = 1 | |
| df_transactions.head() |