Skip to content

Instantly share code, notes, and snippets.

.DS_Store
*.log
Gemfile.lock
@mrmichalis
mrmichalis / jstackSeries.sh
Created April 2, 2013 10:03
Just run it like this: sh jstackSeries.sh [pid] [cq5serveruser] [count] [delay] For example: sh jstackSeries.sh 1234 cq5serveruser 10 3
#!/bin/bash
if [ $# -eq 0 ]; then
echo >&2 "Usage: jstackSeries <pid> <run_user> [ <count> [ <delay> ] ]"
echo >&2 " Defaults: count = 10, delay = 0.5 (seconds)"
exit 1
fi
pid=$1 # required
user=$2 # required
count=${3:-10} # defaults to 10 times
delay=${4:-0.5} # defaults to 0.5 seconds
@mrmichalis
mrmichalis / rackId.py
Last active December 15, 2015 11:39
Cloudera Manager 4.5 compatible Update rackId for all hosts
#!/usr/bin/env python
from cm_api.api_client import ApiResource
from cm_api.endpoints.hosts import ApiHost
import json
def update_rackId(resource_root, host_id, rack_id=None):
resp = resource_root.put('%s/%s' % ("/hosts", host_id), data=json.dumps({"rackId":rack_id}))
return ApiHost.from_json_dict(resp, resource_root)
@mrmichalis
mrmichalis / krb5conf.sh
Last active December 15, 2015 09:29
/etc/krb5.conf /var/kerberos/krb5kdc/kadm5.acl */[email protected] *
#!/usr/bin/env bash
#http://www.cloudera.com/content/cloudera-content/cloudera-docs/CDH4/latest/CDH4-Security-Guide/cdh4sg_topic_3.html
#http://www.cloudera.com/content/cloudera-content/cloudera-docs/CM4Ent/latest/Cloudera-Manager-Managing-Clusters/cmmc_hadoop_security.html
#pre-req
yum install krb5-server krb5-workstation krb5-libs -y
echo "* Downloading Java Cryptography Extension (JCE) ..."
wget --no-check-certificate --no-cookies --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com" http://download.oracle.com/otn-pub/java/jce_policy/6/jce_policy-6.zip -O /root/CDH/jce_policy-6.zip
[[ -d "/usr/java/default/jre/lib/security/" ]] && unzip -oj /root/CDH/jce_policy-6.zip -d /usr/java/default/jre/lib/security/
if [ $# -lt 1 ]; then
#!/bin/bash
#
# createPXE.sh v.02
#
# You MUST edit variables to your environment
# or the deployment will be unsuccessful.
# READ script before executing!
# Note that the subnet variable is NOT your subnet MASK,
# rather the subnet (or network) on which the machine would reside.
@mrmichalis
mrmichalis / getip.sh
Last active December 15, 2015 00:19
for IP in 201 202 247; do ssh root@$IP 'sh -s' < getip.sh >> /etc/hosts; done
#!/usr/bin/env bash
if [ $# -lt 1 ]; then
echo "usage: $0 [hosts list]" 1>&2
exit 1
fi
HOSTSLIST=$1
IPADDR=$(ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}')
if [ -a $HOSTSLIST ]; then
#!/bin/bash
(( $# < 2 )) && { echo "usage: $0 majorversion minorversion"; exit 1; }
vc_osiso="${HOME}/Downloads/CentOS-${1}.${2}-x86_64-minimal.iso"
vc_guestiso='/Applications/VirtualBox.app/Contents/MacOS/VBoxGuestAdditions.iso'
vc_vboxbase="${HOME}/VirtualBox VMs"
vc_basebox="vagrant-centos-${1}-${2}"
vc_hddbase="${vc_vboxbase}/${vc_basebox}/${vc_basebox}"
vc_hddfile="${vc_hddbase}.vdi"
@mrmichalis
mrmichalis / build.gradle
Created February 28, 2013 15:07
Groovy CDH4 v 4.2 project
// original https://gist.github.com/sit/3606537
apply plugin: "java"
apply plugin: "eclipse"
apply plugin: "idea"
group = "com.mycompany.hadoopproject"
version = "1.0"
repositories {
@mrmichalis
mrmichalis / jdbctest.java
Created February 24, 2013 02:11
Connecting to Oracle using Java JDBC
public class OracleJdbcTest
{
String driverClass = "oracle.jdbc.driver.OracleDriver";
Connection con;
public void init(FileInputStream fs) throws ClassNotFoundException, SQLException, FileNotFoundException, IOException
{
Properties props = new Properties();
props.load(fs);
@mrmichalis
mrmichalis / static-ip.sh
Last active December 14, 2015 01:19
static-ip.sh
#!/usr/bin/env bash
if [ $# -lt 1 ]; then
echo "usage: $0 [eth]" 1>&2
exit 1
fi
ETH=$1
IPADDR=$(ip -f inet addr show dev eth0|awk '$1~/inet/{print $2}'|cut -d/ -f1)
HOSTNAME="$(echo $IPADDR | tr '.' '-').lunix.co"