Skip to content

Instantly share code, notes, and snippets.

@paparaka
paparaka / gist:39f74dd5135f7ec659067fd13cb54866
Created March 28, 2019 16:07
Brexit alternative votes parsed in R
require(rvest)
require(stringr)
require(data.table)
require(tidyverse)
library(dplyr)
#Specifying the url for desired website to be scraped
url <- 'https://www.theguardian.com/uk-news/ng-interactive/2019/mar/27/how-did-your-mp-vote-in-the-indicative-votes'
#Reading the HTML code from the website
webpage <- read_html(url)
---
version: '2'
services:
jupyter:
image: jupyter/scipy-notebook
container_name: jupyter
command: start.sh jupyter lab --LabApp.token='*******************' --LabApp.allow_remote_access='True' --LabApp.allow_origin='*'
restart: always
@paparaka
paparaka / clickhouse_replacing_engine.sql
Last active April 17, 2019 10:34
ClickHouse replacing Merge Tree engine inner workings
DROP TABLE tmp_test_replacing;
-- Create a table with the ReplacingMergeTree Engine
CREATE TABLE IF NOT EXISTS tmp_test_replacing (
ts Date,
sort_var1 String,
sort_var2 String,
version_var UInt64,
indep_var UInt64
)
@paparaka
paparaka / kubectl_cheatsheet
Last active October 22, 2019 09:20
Common commands for kubectl
# Change namespace:
kubectl config set-context --current --namespace=
# Run a Debug container. Remember to add namespace
kubectl run -it --rm --restart=Never alpine --image=alpine sh
## The in alpine run
apk add curl
@paparaka
paparaka / cloudbuild.tf
Last active November 13, 2022 18:39
K8.Jinja.Templating
############################################################################################
# A sample Terraform file that creates the cloud build trigger.
############################################################################################
resource "google_cloudbuild_trigger" "develop_trigger" {
description = "[DEVELOP] Build develop branch"
filename = "cloudbuild.yaml"
trigger_template {
branch_name = "^develop$"
repo_name = "houston"
}
@paparaka
paparaka / Dockerfile
Last active February 8, 2020 20:02
K8.Testing.CloudBuild
FROM gcr.io/cloud-builders/gcloud
RUN apt-get -y update && \
apt-get -y install python3 python3-dev python3-setuptools python3-pip
RUN pip3 install PyYAML Jinja2 simplejson kubernetes \
google-cloud-storage google-api-python-client
RUN apt-get -y remove python-dev python-setuptools wget && \
rm -rf /var/lib/apt/lists/* && \
@paparaka
paparaka / app.py
Last active March 6, 2020 16:32
Flask.Exception.Chaining
"""
An example Flask app that uses Exceptions to return errors to clients
"""
from flask import Flask, jsonify
app = Flask(__name__)
class APIError(Exception):
"""All custom API Exceptions"""