Skip to content

Instantly share code, notes, and snippets.

@xman1980
xman1980 / dump_cloudera_manager.py
Created June 11, 2018 08:04 — forked from sit/dump_cloudera_manager.py
A quick and dirty script to dump the cluster/service/role configuration via the Cloudera Manager API http://cloudera.github.io/cm_api/.
#!/usr/bin/env python
from cm_api.api_client import ApiResource
def main(args):
cm_host = get(args, 1, "localhost")
cm_user = get(args, 2, "admin")
cm_pass = get(args, 3, "admin")
api = ApiResource(cm_host, username=cm_user, password=cm_pass)
@xman1980
xman1980 / ip-down
Created June 25, 2018 07:10 — forked from copiousfreetime/ip-down
PPP ip-up/ip-down for vpn with optional dns resolving
#!/bin/sh
# install into /etc/ppp/ip-down
# chmod a+x /etc/ppp/ip-down
source /etc/ppp/ip.config
case "${IPREMOTE}" in
${MY_IPREMOTE})
/sbin/route delete ${MY_ROUTE} -interface ${IFNAME}
#!/bin/bash
# Minimum TODOs on a per job basis:
# 1. define name, application jar path, main class, queue and log4j-yarn.properties path
# 2. remove properties not applicable to your Spark version (Spark 1.x vs. Spark 2.x)
# 3. tweak num_executors, executor_memory (+ overhead), and backpressure settings
# the two most important settings:
num_executors=6
executor_memory=3g
@xman1980
xman1980 / kafka-cheat-sheet.md
Created August 21, 2018 15:39 — forked from ursuad/kafka-cheat-sheet.md
Quick command reference for Apache Kafka

Kafka Topics

List existing topics

bin/kafka-topics.sh --zookeeper localhost:2181 --list

Describe a topic

bin/kafka-topics.sh --zookeeper localhost:2181 --describe --topic mytopic

Purge a topic

bin/kafka-topics.sh --zookeeper localhost:2181 --alter --topic mytopic --config retention.ms=1000

... wait a minute ...

@xman1980
xman1980 / iterm2.md
Created September 6, 2018 19:09 — forked from squarism/iterm2.md
iterm2 cheatsheet

Tabs and Windows

Function Shortcut
Fullscreen + Enter
Previous Tab + Left Arrow
Next Tab + Right Arrow
Go to Tab + Number
Go to Window + Option + Number
Go to Split Pane by Direction + Option + Arrow
@xman1980
xman1980 / mongo_redhat_cent_7_install.sh
Created September 26, 2018 07:26 — forked from kennwhite/mongo_redhat_cent_7_install.sh
Install latest MongoDB on RedHat/CentOS 7
#!/bin/bash
# Simple install script for stock RedHat/CentOS 7.x
# Allows yum update to pull security & other fixes automatically from MongoDB.com's repos
# (versus ancient packages in Red Hat/Cent repos)
# To completely purge all remnants of Mongo (repo conf, rpms, yum cache, DB files, kernel tweaks:
# sudo service mongod stop ; sudo rm -rf /etc/yum.repos.d/mongo* ; sudo rm -rf /var/lib/mongo/* ; sudo sed -i.`date +%Y-%m-%d_%H-%M-%S`.bak '/^#.*$/!d' /etc/rc.d/rc.local ; sudo rm -rf /var/cach/yum ; sudo yum -y clean all ; sudo yum -y remove mongodb*
# Sanity check - are we on a RH family distro?
[ -f "/etc/redhat-release" ] || { echo -e "This script requires RedHat or CentOS. Quitting. \n"; exit 1 ;}
@xman1980
xman1980 / cf_ban
Created October 28, 2018 22:03 — forked from pjv/cf_ban
Cloudflare v4 API ban and urban bash scripts
#!/bin/bash
# dependencies: curl
# example usage: cf_ban 192.168.0.1
# append cloudflare email address and API token:
USER=
TOKEN=
@xman1980
xman1980 / install_spark_centos7.sh
Created November 5, 2018 14:16 — forked from darcyliu/install_spark_centos7.sh
Install Spark on CentOS 7
#!/bin/bash
# Install Spark on CentOS 7
yum install java -y
java -version
yum install wget -y
wget http://downloads.typesafe.com/scala/2.11.7/scala-2.11.7.tgz
tar xvf scala-2.11.7.tgz
sudo mv scala-2.11.7 /usr/lib
sudo ln -s /usr/lib/scala-2.11.7 /usr/lib/scala
@xman1980
xman1980 / docker-cleanup.sh
Created August 26, 2019 18:23 — forked from stanislavb/docker-cleanup.sh
Docker clean-up script for cron
#!/bin/bash
# Do not run if removal already in progress.
pgrep "docker rm" && exit 0
# Remove Dead and Exited containers.
docker rm $(docker ps -a | grep "Dead\|Exited" | awk '{print $1}'); true
# It will fail to remove images currently in use.
docker rmi $(docker images -qf dangling=true); true