Skip to content

Instantly share code, notes, and snippets.

View nitrocode's full-sized avatar
🚀
Thinking and typing

nitrocode nitrocode

🚀
Thinking and typing
View GitHub Profile
@nitrocode
nitrocode / create-tomcat-war.sh
Created August 20, 2015 05:42
Creates a TomCat or JBoss compressed and deployable WAR file
#!/bin/bash
# Usage: ./create-war.sh DIRECTORY WARFILE
# e.g. ./create-war.sh Siesta Siesta.war
DIRECTORY=$1
WARFILE=$2
cd $DIRECTORY/WebContent
jar -cf ../../$WARFILE *
cd -
ls -l $WARFILE
#!/usr/bin/python
# addmount.py
#
# This will add a shared drive using a given password. Only requirement is pexpect which can be downloaded using apt-get or pip
#
# - password contains $ and ! marks that need to be escaped
# - had issues putting these in the -o "password=" param and had issues with the cred file
import pexpect
password = "$wirleysaysneverquit!!!"
#!/bin/sh
# Usage:
# ./clone.sh TESTENV_TO_CLONE_DIR NEW_TEST_ENV_DIR
# ./clone.sh TESTENV08-HOST TESTENV03-HOST
# The above will clone 08 to 03 and register the vm
#
# * Do not end the argument directories with a slash!
# Date: Mar 10, 2015
DIR_DS=$(pwd)
@nitrocode
nitrocode / SetIP.ps1
Last active November 16, 2015 17:53
Powershell 2 script to change the IP with arguments
# Usage: powershell -File SetIP.ps1 -ip "101.54.149.103"
# Works on Windows 7 64bit
# get params
param (
[string]$ip = "101.54.149.106",
[string]$gw = "101.54.149.1",
[string]$sub = "255.255.255.0",
[string]$dns1 = "101.61.241.311",
[string]$dns2 = "101.61.251.311"
@nitrocode
nitrocode / SetHostname.ps1
Last active November 16, 2015 17:52
Powershell 2 script to change the hostname
# Usage: powershell -File SetHostname.ps1 -name "Terminator"
# Works on Windows 7 64bit
# Requires restart for changes to take effect
# get params
param (
[string]$name = "Dev"
)
Write-Host "Server: $name"
#!/bin/bash
# Original: http://steve-jansen.github.io/blog/2014/11/20/how-to-use-jenkins-to-monitor-cron-jobs/
# example cron script to post logs to Jenkins
# exit on error
set -e
log=`mktemp tmp.XXX`
timer=`date +"%s"`
jenkins_job=my_monitoring_job
@nitrocode
nitrocode / run-ssh-command-no-matter-what.py
Last active February 15, 2016 20:41
Runs ssh commands on an ssh enabled machine
#!/usr/bin/env python
# Edit: curious if netmiko would work with the SSA devices too: https://github.com/ktbyers/netmiko
# Edit2: Used netmiko to create a handler for extreme and enterasys switches to make the below code even simpler
# https://gist.github.com/nitrocode/ce888d3eb529cf78f4e0
import sys
import paramiko
import time
# seems to work for all switches and ssh enabled devices
@nitrocode
nitrocode / run-ssh-command-enterasys-extreme.py
Last active March 18, 2024 11:40
Run an ssh command on Enterasys or Extreme switches using netmiko
#!/usr/bin/env python
# This will run an ssh command successfully on an enterasys SSA and so SSH must be enabled on the device(s).
# paramiko can be used but netmiko simplifies the code for these switches if you set the device_type to "a10"
from netmiko import ConnectHandler
#enterasyshandle = {'device_type':'a10', 'ip' : '10.54.116.175', 'username':'admin', 'password':''}
enterasyshandle = {'device_type':'enterasys', 'ip' : '10.54.116.175', 'username':'admin', 'password':''}
net_connect = ConnectHandler(**enterasyshandle)
output = net_connect.send_command('show config policy')
@nitrocode
nitrocode / cygwin-ultimate-pkg-installer.sh
Last active August 14, 2020 21:47
Cygwin ultimate package installer
#!/bin/bash
# install apt-cyg fork
lynx -source https://raw.githubusercontent.com/kou1okada/apt-cyg/master/apt-cyg > apt-cyg
install apt-cyg /bin
# update
apt-cyg update
# install everything
@nitrocode
nitrocode / choco-ultimate-pkg-installer.bat
Last active January 26, 2016 17:42
Chocolatey ultimate package installer
:: install choco
@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin
:: use choco to install packages in the following categories:
:: - cleaning, commandline, programming, browsers, networking, and dependencies
choco install bleachbit ccleaner conemu cygwin ultradefrag notepadplusplus atom visualcplusplusexpress2008 python2 eclipse firefox google-chrome-x64 tightvnc putty wireshark nmap filezilla rdcman dotnet3.5 javaruntime -y