Skip to content

Instantly share code, notes, and snippets.

View Buttonwood's full-sized avatar

Buttonwood Buttonwood

View GitHub Profile
@Buttonwood
Buttonwood / xrdp_rhel_centos_6.md
Created August 31, 2022 01:07 — forked from dduvnjak/xrdp_rhel_centos_6.md
Setting up xrdp on RHEL 6

1 - Install the prerequisites for building and installation

yum groupinstall Desktop -y
yum install finger cmake patch gcc make autoconf libtool automake pkgconfig openssl-devel gettext file pam-devel libX11-devel libXfixes-devel libjpeg-devel
yum install flex bison gcc-c++ libxslt perl-libxml-perl xorg-x11-font-utils tigervnc-server git -y
reboot

2 - Get the latest source from the xrdp git repo, build and install

git clone git://github.com/FreeRDP/xrdp.git
#!/usr/bin/python
import sys
from cm_api.api_client import ApiResource
## ** CM Connection Settings ******************************
cm_host = "localhost"
cm_port = "7180"
cm_login = "admin"
cm_password = "admin"
#!/usr/bin/python
## ********************************************************************************
## mr-usage-by-user.py
##
## Aggregates YARN MapReduce usage by day and user and writes the results to the console and to a file
##
## As the CM-API call "yarn.get_yarn_applications" can only return 1000 jobs max per call the script will make
## multiple calls to yarn.get_yarn_applications and aggregate all results between the script's global start and end times
##
@Buttonwood
Buttonwood / get-yarn-long-running-jobs.py
Created June 13, 2019 02:19 — forked from onefoursix/get-yarn-long-running-jobs.py
Example of using the Cloudera Manager API to poll for YARN health checks and to list long running jobs using a tsquery
#!/usr/bin/python
## ********************************************************************************
## get-yarn-long-running-jobs.py
##
## Usage: ./get-yarn-long-running-jobs.py
##
## Edit the settings below to connect to your Cluster
##
## ********************************************************************************
@Buttonwood
Buttonwood / get-hive-yarn-jobs-for-sentry-user.py
Created June 13, 2019 02:19 — forked from onefoursix/get-hive-yarn-jobs-for-sentry-user.py
Example of how to get info on Hive YARN jobs for a specific Sentry user using the Cloudera Manager API
#!/usr/bin/python
## ********************************************************************************
## get-hive-yarn-jobs-for-sentry-user.py
##
## Example of how to retrieve info on YARN Hive jobs for a given Sentry user
## using the Cloudera Manager API
##
## Usage: ./get-hive-yarn-jobs-for-sentry-user.py <sentry_user_name>
##
@Buttonwood
Buttonwood / impalaQueries.py
Created June 13, 2019 02:19 — forked from onefoursix/impalaQueries.py
Python CM-API Example to pull Impala Query metrics
#!/usr/bin/python
## *******************************************************************************************
## impalaQueries.py
##
## Getting Info on Impala Queries
##
## Usage: ./impalaQueries.py
##
## *******************************************************************************************
Args <- commandArgs()
library('rCharts', 'ramnathv')
df <- read.csv(Args[4],header = FALSE, sep = ";")
#num <- df[,c(1,2,4,6)]
num <- df[,c(1,2,3)]
#time <- df[,c(1,3,5,7)]
colnames(num) <- c("date","num", "time")
#colnames(time) <- c("date","1", "3","20")
transform(num, date = as.character(date))
#transform(time, date = as.character(date))
use List::Util qw/sum/;
my $gap = 2;
my %data;
while(<>){
chomp;
my @t = split(";");
my @a = split(/\s+|\:/,$t[1]);
my $n = int($a[1] / $gap) * $gap;
my $time = ($n < 10) ? "0$n:00:00" : "$n:00:00";
# perl grep.pl case.csv slow-query.log.keys.csv
use IO::File;
open(IN,"<$ARGV[0]");
my $count = 0;
my %fh;
while(<IN>){
chomp;
my @t = split(";");
use List::Util qw/max min sum/;
my %data;
while(<>){
my @arr = split("%########%");
my @sql = split(";",$arr[-1]);
=pod
my $a = &phaser_sql(&trans_sql($sql[0]));
my $b = &phaser_keys($a);
print "$sql[0]\n$a\n$b\n";