Skip to content

Instantly share code, notes, and snippets.

@nohtyp
nohtyp / server.rb
Created February 21, 2015 01:19
Server side ruby script
#!/usr/bin/env ruby
require 'socket'
server = TCPServer.new 2000
loop do
client = server.accept
client.puts '/etc/passwd'
client.close
@nohtyp
nohtyp / client.rb
Created February 21, 2015 01:18
Client ruby script
#!/usr/bin/env ruby
require 'socket'
s = TCPSocket.new 'localhost', 2000
while line = s.gets
system 'cat ' + line
end
s.close
@nohtyp
nohtyp / choiceagent.sh
Created October 23, 2014 18:46
This script goes to choice.py script that deals with remote management(I use puppet now..:-) )
#!/bin/bash
case $0 in
*create)
answer="chage -l $1;$?"
if [ "$answer | awk -F';' '{ print $2 }' == 0" ]; then
#echo "The command was sent to $HOSTNAME successfully!"
echo "The command was sent to $HOSTNAME successfully!"
chage -l $1
@nohtyp
nohtyp / choice.py
Created October 23, 2014 18:43
This script was a sample of remote manage server using python..I have a client (using bash..for testing)
#!/usr/bin/python
import os
def print_menu():
print
print
print "--------------------------------"
print "What would you like to do? "
@nohtyp
nohtyp / npm_exec
Created August 9, 2014 18:19
This gist is to be used with the hubot gist so that you can execute the script from any directory. This file goes in /usr/local/bin/ (so it's executable by everyone)
#Web url where info was obtained
#http://lostechies.com/derickbailey/2012/04/24/executing-a-project-specific-nodenpm-package-a-la-bundle-exec/
/home/hubot/myhubot/node_modules/.bin/$@
@nohtyp
nohtyp / hubot.sh
Last active August 29, 2015 14:05
This gist starts/stops hubot on a Linux system
#!/bin/bash
#https://gist.github.com/febuiles/1394520
# This assumes you have:
# 1) A user called `hubot` in charge of the bot.
# 2) A file called /home/hubot/.hubotrc that contains the Hubot credentials.
#
# To set the adapter either edit bin/hubot to specify what you want or append
# `-- -a campfire` to the $DAEMON variable below.
#
@nohtyp
nohtyp / dbora.sh
Created July 16, 2014 09:08
This gist is a shutdown and startup script for oracle.
#!/bin/bash
#dbora Oracle Database script
#
# chkconfig: 345 85 35
# description: This script starts and stops the Oracle databases
# and creates an output file of the returned messages
#
#
#author: Thomas Foster
#co-author: Brian Doran
@nohtyp
nohtyp / add_cd_to_vmware.rb
Last active August 29, 2015 14:03
This gist will add a cd that has an iso to vsphere 5.1
#!/usr/bin/env ruby
require 'yaml'
require 'rbvmomi'
hosts = ['VCenter host']
datacenters = ['datacenter']
templates = ['relativepath/vm']
mount = true
config_file = File.expand_path('~/.fog')
@nohtyp
nohtyp / splunkupgrade fact
Created May 8, 2014 19:44
This fact will allow check of which version of splunk is installed.
#Splunk Universal Forwarder Version
Facter.add("SplunkUF_Version") do
setcode do
SplunkUF_Version = Facter::Util::Resolution.exec("/opt/splunkforwarder/bin/splunk --version | awk {'print $4'}")
if SplunkUF_Version.length < 6
while SplunkUF_Version.length < 10 do
SplunkUF_Version.insert(-1, '.0')
end
@nohtyp
nohtyp / genpass.py
Created April 24, 2014 20:22
Python password generator from a file
#!/usr/bin/env python
import sys, getopt, random
def main(inputpass):
try:
passopts, passargs = getopt.getopt(inputpass, "hl:n:d:s:f:", ["help", "length=", "digits=", "special=", "file="])