Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Sam Bessalah samklr

🎯
Focusing
Block or report user

Report or block samklr

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@samklr
samklr / clean-slate.sh
Created Dec 7, 2018 — forked from noisesmith/clean-slate.sh
clean some things from zk, kafka, mongo
View clean-slate.sh
#!/bin/sh
# vars
## EDITOR/VISUAL - what process to use to pick targets interactively
## ZK_WL - regex for zookeeper paths not to remove
## KAFKA_WL - regex for kafka topics not to remove
## MONGO_WL - regex for mongo item ids not to remove
# set -x
@samklr
samklr / article.md
Last active Nov 12, 2018 — forked from jkpl/article.md
Error handling pitfalls in Scala
View article.md

Error handling pitfalls in Scala

There are multiple strategies for error handling in Scala.

Errors can be represented as [exceptions][], which is a common way of dealing with errors in languages such as Java. However, exceptions are invisible to the type system, which can make them challenging to deal with. It's easy to leave out the necessary error handling, which can result in unfortunate runtime errors.

@samklr
samklr / article.org
Created Nov 12, 2018 — forked from jkpl/article.org
Enforcing invariants in Scala datatypes
View article.org

Enforcing invariants in Scala datatypes

Scala provides many tools to help us build programs with less runtime errors. Instead of relying on nulls, the recommended practice is to use the Option type. Instead of throwing exceptions, Try and Either types are used for representing potential error scenarios. What’s common with these features is that they’re used for capturing runtime features in the type system, thus lifting the runtime scenario handling to the compilation phase: your program doesn’t compile until you’ve explicitly handled nulls, exceptions, and other runtime features in your code.

In his “Strategic Scala Style” blog post series,

@samklr
samklr / kafka-cheat-sheet.md
Created Nov 9, 2018 — forked from sahilsk/kafka-cheat-sheet.md
Apache Kafka Cheat Sheet
View kafka-cheat-sheet.md

Kafka Cheat Sheet

Display Topic Information

$ kafka-topics.sh --describe --zookeeper localhost:2181 --topic beacon
Topic:beacon	PartitionCount:6	ReplicationFactor:1	Configs:
	Topic: beacon	Partition: 0	Leader: 1	Replicas: 1	Isr: 1
	Topic: beacon	Partition: 1	Leader: 1	Replicas: 1	Isr: 1
@samklr
samklr / TODO
Created Sep 11, 2018 — forked from perrygeo/TODO
Ansible playbook for a full dev environment
View TODO
TODO
implement security measures
git config
config files
full sublimetext config
set up openvpn
rdesktop and network drive to terra
set up evolution
RStudio
@samklr
samklr / git-workflow.md
Created Sep 6, 2018 — forked from forest/git-workflow.md
Git Feature Branch Workflow
View git-workflow.md

We subscribe to the Git Featrue Branch workflow, briefly described in that link.

In practice, it works as follows:

FEATURE DEVELOPMENT

Steps to Follow:

  1. Start with an updated local development branch -- by checking out the dev branch and pulling changes:
    git checkout development
    git pull origin development
View v_space_by_schema.sql
CREATE OR REPLACE VIEW admin.v_space_by_schema
AS
WITH CAPACITY AS
(
SELECT SUM(capacity) FROM stv_partitions
),
USAGE AS
(
SELECT TRIM(pgdb.datname) AS DATABASE,
TRIM(pgn.nspname) AS SCHEMA,
@samklr
samklr / setup-notes.md
Created Jun 28, 2018 — forked from eddies/setup-notes.md
Spark 2.0.0 and Hadoop 2.7 with s3a setup
View setup-notes.md

Standalone Spark 2.0.0 with s3

###Tested with:

  • Spark 2.0.0 pre-built for Hadoop 2.7
  • Mac OS X 10.11
  • Python 3.5.2

Goal

Use s3 within pyspark with minimal hassle.

View redshift_table_usage.sql
SELECT TRIM(pgdb.datname) AS DATABASE,
TRIM(pgn.nspname) AS SCHEMA,
TRIM(a.name) AS TABLE,
b.mbytes,
a.rows
FROM (SELECT db_id,
id,
name,
SUM(ROWS) AS ROWS
FROM stv_tbl_perm a
@samklr
samklr / bootstrap_jupyter.sh
Created May 25, 2018 — forked from nicor88/bootstrap_jupyter.sh
Bootstrap action to install Conda and Jupyter on EMR
View bootstrap_jupyter.sh
#!/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
You can’t perform that action at this time.