Skip to content

Instantly share code, notes, and snippets.

Avatar

Hari Sekhon HariSekhon

View GitHub Profile
@HariSekhon
HariSekhon / osx_defaults.sh
Created Sep 29, 2020 — forked from vraravam/osx_defaults.sh
OSX Defaults to setup a brand new machine
View osx_defaults.sh
#!/usr/bin/env bash
# TODO: Need to figure out the settings for the following:
# 1) Dock: Items with order (not capturing binary data - since that is dependent on installed apps)
# 2) Security & Privacy Preferences: Full Disk Access, Camera, Microphone
# 3) Login items for my user (i.e. apps started when I login)
# 4) Retina displays
##
# This is a script with useful tips taken from:
View git-io-custom-url.md

Command:

curl https://git.io/ -i -F "url=https://github.com/YOUR_GITHUB_URL" -F "code=YOUR_CUSTOM_NAME"

URLs that can be created is from:

  • https://github.com/*
  • https://*.github.com
  • https://*.github.com/*
  • https://*.github.io
View git-io-custom-url.md

Command:

curl https://git.io/ -i -F "url=https://github.com/YOUR_GITHUB_URL" -F "code=YOUR_CUSTOM_NAME"

URLs that can be created is from:

  • https://github.com/*
  • https://*.github.com
  • https://*.github.com/*
  • https://*.github.io
View bash.generate.random.alphanumeric.string.sh
#!/bin/bash
# bash generate random alphanumeric string
#
# bash generate random 32 character alphanumeric string (upper and lowercase) and
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# bash generate random 32 character alphanumeric string (lowercase only)
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1
@HariSekhon
HariSekhon / apt_wait.sh
Created Jun 7, 2020 — forked from tedivm/apt_wait.sh
A BASH function to wait for `apt` to finish and release all locks.
View apt_wait.sh
#!/usr/bin/env bash
apt_wait () {
while sudo fuser /var/lib/dpkg/lock >/dev/null 2>&1 ; do
sleep 1
done
while sudo fuser /var/lib/apt/lists/lock >/dev/null 2>&1 ; do
sleep 1
done
if [ -f /var/log/unattended-upgrades/unattended-upgrades.log ]; then
View tmux-cheatsheet.markdown

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
View tez_rest_api_calls
--get running applications
http://seregion02.cloud.hortonworks.com:8088/ws/v1/cluster/apps?states=accepted,running
--get dag id for counters and callerId (hive session) for hive details
http://seregion02.cloud.hortonworks.com:8188/ws/v1/timeline/TEZ_DAG_ID?limit=1000&primaryFilter=applicationId%3Aapplication_1458195563211_0034
--get counters on the fly
http://seregion02.cloud.hortonworks.com:8088/proxy/application_1458195563211_0034/ws/v2/tez/verticesInfo?dagID=2&counters=org.apache.tez.common.counters.FileSystemCounter%2FHDFS_BYTES_WRITTEN%2CHDFS_BYTES_READ%3Borg.apache.tez.common.counters.TaskCounter%2FNUM_SPECULATIONS%2CREDUCE_INPUT_GROUPS
http://seregion02.cloud.hortonworks.com:8088/proxy/application_1458195563211_0034/ws/v2/tez/verticesInfo?dagID=3&counters=*
@HariSekhon
HariSekhon / compare_buckets.py
Created Oct 18, 2019 — forked from tomkinsc/compare_buckets.py
This is a quick and dirty script to compare two different s3-compatible buckets, just dorp in the bucket name and credentials, and optionally change the endpoint host
View compare_buckets.py
#!/usr/bin/python
import boto, json
from boto.s3.connection import S3Connection
from boto.gs.connection import GSConnection
def compare_buckets(bucket_one_bucket_name,
bucket_two_bucket_name,
bucket_one_access_key_id,
@HariSekhon
HariSekhon / check_hbase_onlineregions.sh
Created Dec 24, 2018 — forked from ashrithr/check_hbase_onlineregions.sh
nagios plugin for hbase to check how many regions a region server is serving and throw critical if regions > 90
View check_hbase_onlineregions.sh
#!/usr/bin/env bash
#Author: Ashrith
#Arrays to store hosts and their regionsOnLine respectively
declare -a HOSTS_ARRAY
declare -a REGIONS_ARRAY
message=""
EXIT_STATUS=0