Skip to content

Instantly share code, notes, and snippets.

View chrislovecnm's full-sized avatar
😃
Living LIFE!!

Chris Love chrislovecnm

😃
Living LIFE!!
View GitHub Profile
@chrislovecnm
chrislovecnm / find-out-what-is-using-your-swap.sh
Last active December 23, 2015 14:59
what is using your swap find-out-what-is-using-your-swap.sh
#!/bin/bash
# find-out-what-is-using-your-swap.sh
# -- Get current swap usage for all running processes
# --
# -- rev.0.3, 2012-09-03, Jan Smid - alignment and intendation, sorting
# -- rev.0.2, 2012-08-09, Mikko Rantalainen - pipe the output to "sort -nk3" to get sorted output
# -- rev.0.1, 2011-05-27, Erik Ljungstrom - initial version
@chrislovecnm
chrislovecnm / gist:7145704
Created October 24, 2013 21:52
cookies with HTTP spring rest
HttpHeaders requestHeaders = new HttpHeaders();
requestHeaders.add("Cookie", "JSESSIONID=" + session.getValue());
HttpEntity requestEntity = new HttpEntity(null, requestHeaders);
ResponseEntity rssResponse = restTemplate.exchange(
"https://jira.example.com/sr/jira.issueviews:searchrequest-xml/18107/SearchRequest-18107.xml?tempMax=1000",
HttpMethod.GET,
requestEntity,
Rss.class);
Rss rss = rssResponse.getBody();
@chrislovecnm
chrislovecnm / puppetdb test
Created May 28, 2014 19:17
puppetdb test
curl 'http://puppetmaster:8080/v3/resources/Notify/foobar'
[]
cat test.pp
@@notify { "foobar": }
puppet apply test.pp --debug | tee /tmp/puppet.out
^[[0;36mDebug: Configuring PuppetDB terminuses with config file /etc/puppet/puppetdb.conf^[[0m
^[[0;36mDebug: Failed to load library 'selinux' for feature 'selinux'^[[0m
@chrislovecnm
chrislovecnm / copy_lvs.sh
Created June 12, 2014 19:08
Copy a LVS logical volume between volume groups
#!/bin/bash
export mount_point=$1
if [[ -z "$mount_point" ]]; then
echo "pass in drive name as first argument";
exit 1;
fi
# Sanity check that lv is not used
lvuses="$( lvdisplay -c /dev/vg0/${mount_point} | cut -d ':' -f 6 )"
@chrislovecnm
chrislovecnm / install_repos.sh
Created June 13, 2014 00:46
install ubuntu dse and puppet
apt-get install software-properties-common
add-apt-repository ppa:webupd8team/java
echo "deb http://username:password@debian.datastax.com/enterprise stable main" | sudo tee -a /etc/apt/sources.list.d/datastax.sources.list
apt-get install curl
curl -L https://debian.datastax.com/debian/repo_key | sudo apt-key add -
curl -L https://apt.puppetlabs.com/puppetlabs-release-trusty.deb | dpkg -i -
apt-get update
apt-get install oracle-java7-installer
apt-get install dse-full
apt-get install puppet
@chrislovecnm
chrislovecnm / show_chmod_numbers.sh
Created June 27, 2014 17:03
get chmod numbers for a directory
#!/bin/bash
// get the chmod numbers for a directory
// http://stackoverflow.com/questions/1795976/can-the-unix-list-command-ls-output-numerical-chmod-permissions/1796009
ls -l | awk '{k=0;for(i=0;i<=8;i++)k+=((substr($1,i+2,1)~/[rwx]/) \
*2^(8-i));if(k)printf("%0o ",k);print}'
@chrislovecnm
chrislovecnm / nodetool_stats.sh
Last active August 29, 2015 14:11
Monitoring netstats - one lines
while true; do echo "$(nodetool netstats | grep Receiving)"; echo " Finished $(nodetool netstats | grep data | grep cassandr | wc -l)"; echo "$(nodetool netstats | grep -v 100% | grep data)";echo "--------" && sleep 30; done;
@chrislovecnm
chrislovecnm / gist:4af766fdcaec9da01003
Last active August 29, 2015 14:13
Gentoo Perl Purgatory
emerge -av -1 -O =dev-lang/perl-5.18* $(eix '-I#' 'virtual/perl-*') dev-perl/extutils-pkgconfig
perl-cleaner --reallyall -- -v
emerge -vuDN world --with-bdeps=y
@chrislovecnm
chrislovecnm / jmxtrans
Last active November 6, 2015 21:42
jmxtrans debian init script
#!/bin/sh
### BEGIN INIT INFO
# Provides: jmxtrans
# Required-Start: $local_fs $network $named $time $syslog
# Required-Stop: $local_fs $network $named $time $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Description: JMX Proxy
### END INIT INFO
@chrislovecnm
chrislovecnm / install-stack-cass.sh
Last active November 6, 2015 21:46
Install Stackdriver and JMX Trans for Cassandra
#!/bin/bash
STACKDRIVER_API_KEY=$1
JMX_HOST="localhost"
JMX_PORT="7199"
CASSANDRA_HOST="localhost"
CASSANDRA_PORT="7199"
curl -O https://repo.stackdriver.com/stack-install.sh
sudo bash stack-install.sh --api-key=$STACKDRIVER_API_KEY