Skip to content

Instantly share code, notes, and snippets.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@davified
davified / topkeywords.js
Created August 25, 2016 22:56 — forked from elliotbonneville/topkeywords.js
Find top keywords associated with a Google search with this Node.js application.
var request = require("request"),
cheerio = require("cheerio"),
url = "https://www.google.com/search?q=data+mining",
corpus = {},
totalResults = 0,
resultsDownloaded = 0;
function callback () {
resultsDownloaded++;
@davified
davified / .env
Last active March 17, 2018 00:15
Including mongoose and tests
MONGODB_URI=mongodb://localhost/replace_with_your_own_local_db
import React from "react";
import { BrowserRouter, Route, Switch, Redirect } from "react-router-dom";
import { CookiesProvider } from "react-cookie";
import Header from "./Header/Header";
import Footer from "./Footer/Footer";
import Home from "./Home/Home";
import NotFound from "./NotFound/NotFound";
import Login from "./Account/Login/Login";
import WrappedSignup from "./Account/Signup/WrappedSignup";
import Profile from "./Account/Profile/Profile";
@davified
davified / hive-docker-instructions.md
Last active September 19, 2018 01:35
hive-docker-instructions
$ git clone https://github.com/big-data-europe/docker-hive
$ cd docker-hive
$ docker-compose up -d

connect to hive-server docker container
$ docker-compose exec hive-server bash

connect (to hive CLI?) using beeline
# /opt/hive/bin/beeline -u jdbc:hive2://localhost:10000
@davified
davified / heroku.config.yml
Last active February 13, 2019 06:40
Sample CircleCI config for python ML project
# .circleci/config.yml
# A circleci config for deploying https://github.com/davified/ci-workshop-app to heroku
version: 2
jobs:
train_and_test:
docker:
- image: circleci/python:3.6.1
working_directory: ~/repo
steps:
- checkout
# .circleci/config.yml
# a script for deploying https://github.com/davified/ci-workshop-app to GCP App Engine
version: 2
jobs:
train_and_test:
docker:
- image: circleci/python:3.6.1
working_directory: ~/repo
steps:
- checkout
@davified
davified / heroku_docker_deployment.md
Created February 24, 2019 08:42
Steps for deploying a docker image to heroku

Steps for deploying a docker image to heroku

  • docker build ...
  • heroku create david-docker-staging
  • docker login --username=_ --password=$(heroku auth:token) registry.heroku.com
  • docker push
  • heroku container:release web -a app_name
  • heroku open
@davified
davified / config.yml
Created February 27, 2019 14:02
CircleCI + Docker + Kubernetes + caching docker images on CircleCI
# .circleci/config.yml
# CircleCI config for deploying docker containers to kubernetes + manual caching on CircleCI
version: 2
jobs:
build_and_test:
working_directory: ~/repo
docker:
- image: google/cloud-sdk
steps:
- checkout
def unexpectedly_mutate_original_data(cats):
_cats = cats.copy() # list.copy() method is a shallow copy. see https://docs.python.org/3/tutorial/datastructures.html
for cat in cats:
cat['new'] = 'something new'
return cats
original = [{'name': 'brownie'}, {'name': 'fluffy'}]
result = unexpectedly_mutate_original_data(original)
print(original) # see that original value is mutated