Skip to content

Instantly share code, notes, and snippets.

View daniel-cortez-stevenson's full-sized avatar
🦊
I'm around

Daniel daniel-cortez-stevenson

🦊
I'm around
View GitHub Profile
@terrancesnyder
terrancesnyder / node-0mq-ctrl-c.js
Created September 7, 2012 21:14
Handling Ctrl-C cleanly in Node.js
// Show how to handle Ctrl+C in Node.js
var zmq = require('zmq')
, socket = zmq.createSocket('rep');
socket.on('message', function(buf) {
// echo request back
socket.send(buf);
});
@BretFisher
BretFisher / .travis.yml
Created February 15, 2016 21:26
Travis-CI Docker Image Build and Push to AWS ECR
sudo: required #is required to use docker service in travis
language: php #can be any language, just php for example
services:
- docker # required, but travis uses older version of docker :(
install:
- echo "install nothing!" # put your normal pre-testing installs here
@cosmincatalin
cosmincatalin / install-rstudio-server.sh
Last active October 27, 2022 11:07
AWS EMR bootstrap to install RStudio Server along with sparklyr
#!/bin/bash
# These variables can be overwritten using the arguments below
VERSION="1.1.463"
# drwho is listed as user in YARN's Resource Manager UI.
USER="drwho"
# Depending on where the EMR cluster lives, you might have to change this to avoid security issues.
# To change the default password (and user), use the arguments bellow.
# If the cluster is not visible on the Internet, you can just leave the defaults for convenience.
PASS="tardis"
@cosmincatalin
cosmincatalin / readme.md
Last active October 27, 2022 11:07
AWS EMR bootstrap to install R packages from CRAN

AWS EMR bootstrap to install R packages from CRAN

This bootstrap is useful if you want to deploy SparkR applications that run arbitrary code on the EMR cluster's workers. The R code will need to have its dependencies already installed on each of the workers, and will fail otherwise. This is the case if you use functions such as gapply or dapply.

How to use the bootstrap

  1. You will first have to download the gist to a file and then upload it to S3 in a bucket of your choice.
  2. Using the AWS EMR Console create a cluster and choose advanced options.
  3. In Step 3 you can configure your bootstraps. Choose to Configure and add a Custom action
@roylee0704
roylee0704 / dockergrep.sh
Created December 9, 2016 08:24
how to grep docker log
docker logs nginx 2>&1 | grep "127."
# ref: http://stackoverflow.com/questions/34724980/finding-a-string-in-docker-logs-of-container
@nicor88
nicor88 / bootstrap_jupyter.sh
Created April 20, 2017 10:23
Bootstrap action to install Conda and Jupyter on EMR
#!/usr/bin/env bash
set -x -e
JUPYTER_PASSWORD=${1:-"myJupyterPassword"}
NOTEBOOK_DIR=${2:-"s3://myS3Bucket/notebooks/"}
# home backup
if [ ! -d /mnt/home_backup ]; then
sudo mkdir /mnt/home_backup
sudo cp -a /home/* /mnt/home_backup
@milesrichardson
milesrichardson / s3download_promise.js
Created August 11, 2017 16:27
S3 download promise: nodeJS promise to download file from amazon S3 to local destination
const AWS = require('aws-sdk');
const fs = require('fs')
const s3download = (bucketName, keyName, localDest) => {
if (typeof localDest == 'undefined') {
localDest = keyName;
}
let params = {
@jancurn
jancurn / hello_world.js
Created September 24, 2018 14:03
Apify SDK hello world example
const Apify = require('apify');
Apify.main(async () => {
const requestQueue = await Apify.openRequestQueue();
await requestQueue.addRequest(new Apify.Request({ url: 'https://www.iana.org/' }));
const pseudoUrls = [new Apify.PseudoUrl('https://www.iana.org/[.*]')];
const crawler = new Apify.PuppeteerCrawler({
requestQueue,
handlePageFunction: async ({ request, page }) => {
@kppullin
kppullin / airflow-k8s-executor-minikube-helm.md
Last active September 12, 2022 19:47
Airflow w/ kubernetes executor + minikube + helm

Overview

The steps below bootstrap an instance of airflow, configured to use the kubernetes airflow executor, working within a minikube cluster.

This guide works with the airflow 1.10 release, however will likely break or have unnecessary extra steps in future releases (based on recent changes to the k8s related files in the airflow source).

Prerequisites

  • Docker installed
  • Minikube installed and started
from airflow import DAG
from airflow.operators import DummyOperator, PythonOperator
default_args = {
'owner': 'arnaud',
'start_date': datetime(2019, 1, 1),
'retry_delay': timedelta(minutes=5)
}
# Using the context manager alllows you not to duplicate the dag parameter in each operator
with DAG('S3_dag_test', default_args=default_args, schedule_interval='@once') as dag: