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 'base64' | |
| require 'digest' | |
| require 'openssl' | |
| require 'fileutils' | |
| module Jekyll | |
| class ProtectedPage < Page | |
| def aes256_encrypt(password, cleardata) | |
| digest = Digest::SHA256.new | |
| digest.update(password) |
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
| from sshtunnel import SSHTunnelForwarder | |
| from sqlalchemy import create_engine | |
| from sqlalchemy.orm import sessionmaker | |
| from functools import wraps | |
| # secrets.py contains credentials, etc. | |
| import secrets | |
| def get_engine_for_port(port): | |
| return create_engine('postgresql://{user}:{password}@{host}:{port}/{db}'.format( |
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
| window_size = 2 | |
| idx_pairs = [] | |
| # for each sentence | |
| for sentence in tokenized_corpus: | |
| indices = [word2idx[word] for word in sentence] | |
| # for each word, threated as center word | |
| for center_word_pos in range(len(indices)): | |
| # for each window position | |
| for w in range(-window_size, window_size + 1): | |
| context_word_pos = center_word_pos + w |
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
| # An example to get the remaining rate limit using the Github GraphQL API. | |
| import requests | |
| headers = {"Authorization": "Bearer YOUR API KEY"} | |
| def run_query(query): # A simple function to use requests.post to make the API call. Note the json= section. | |
| request = requests.post('https://api.github.com/graphql', json={'query': query}, headers=headers) | |
| if request.status_code == 200: |
This file has been truncated, but you can view the full file.
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
| # ************************************************************ | |
| # Sequel Pro SQL dump | |
| # Version 4541 | |
| # | |
| # http://www.sequelpro.com/ | |
| # https://github.com/sequelpro/sequelpro | |
| # | |
| # Host: 127.0.0.1 (MySQL 5.7.16-0ubuntu0.16.04.1) | |
| # Generation Time: 2016-12-21 12:35:15 +0000 |
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
| """Example to show how to plot histogram with accumulate ratio. | |
| Plot multiple histogram using seaborn.FacetGrid() | |
| """ | |
| import numpy as np | |
| import pandas as pd | |
| import matplotlib.pyplot as plt | |
| import seaborn as sns | |
| % matplotlib inline |
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
| # import | |
| import seaborn as sns | |
| import matplotlib.pyplot as plt | |
| # white background in plots | |
| sns.set(style="whitegrid") | |
| # df is a pandas dataframe | |
| # plot by column by variable 'var1', in 3 columns, coloring by variable 'var2' | |
| grid = sns.FacetGrid(df, col='var1', col_wrap=3, hue='var2', size=4, palette='Set2') |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
| What is redash? | |
| Redash is database viewer included BI tool inside. Redash has support for querying multiple databases, including: Redshift, Google BigQuery, PostgreSQL, MySQL, Graphite, Presto, Google Spreadsheets, Cloudera Impala, Hive and custom scripts. | |
| Prerequisite : | |
| 1. Install docker | |
| 2. Install git | |
| git clone https://github.com/getredash/redash.git | |
| docker-compose -f docker-compose.production.yml run --rm server create_db | |
| docker-compose -f docker-compose.production.yml up |
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
| $ cd /usr/local/lib | |
| $ sudo ln -s ../../lib/libSystem.B.dylib libgcc_s.10.5.dylib | |
| $ sudo ln -s ../../lib/libSystem.B.dylib libgcc_s.10.4.dylib |