Skip to content

Instantly share code, notes, and snippets.

View huskercane's full-sized avatar

Rohit Singh huskercane

  • NinjaOne
  • United States
  • 05:24 (UTC -05:00)
View GitHub Profile

Keybase proof

I hereby claim:

  • I am huskercane on github.
  • I am huskercane (https://keybase.io/huskercane) on keybase.
  • I have a public key whose fingerprint is 2034 CBCA C81A 1FED C9B9 04E9 A05D 30F2 FD14 98E3

To claim this, I am signing this object:

@huskercane
huskercane / postgresql.go
Last active August 29, 2015 14:20
Create a physical backend for storing data into postgresql for hashicorp vaultbackend "postgres" { url = "postgres://messagehub:ibm4dmin@localhost/messagehub_development" }
package physical
import (
"database/sql"
"fmt"
"io/ioutil"
"log"
"os"
"sync"
"time"
require 'rest-client'
# create a vsys pattern
def create_vsys_pattern
# POST /resources/virtualSystemPatterns/
# Content-Type - application/zip
# deployer.virtualapplicationpatterns.create('/root/vsys_pattern.zip')
return nil if find_devops_app.size > 0
### Keybase proof
I hereby claim:
* I am huskercane on github.
* I am huskercane (https://keybase.io/huskercane) on keybase.
* I have a public key whose fingerprint is 826D 5461 53C4 7B7A 0E89 71AA EC4C A9A0 AE40 7AC6
To claim this, I am signing this object:
@huskercane
huskercane / firewall_port_test.py
Created March 15, 2015 16:42
Test which ports are open on a firewall. I used it to test my iptables rules localhost, 8080, tcp localhost, 1747, udp, ipv6
__author__ = 'rohits'
import socket
import thread
class PortTester(object):
thread_count = 0
def __init__(self, input, log):
@huskercane
huskercane / sxiSL_51configure_iscsi_formatnewdatastoreonly.sh
Created February 4, 2015 22:43
Find and format new iscsi disk on vmware esx using esxcli command
#!/bin/sh
esxcli storage core path list | grep "Device:" | grep "naa" | awk '{print $2}' | sort > /tmp/2.txt
esxcli storage vmfs extent list | grep naa | awk '{print $4}' | sort > /tmp/1.txt
new_disk=`grep -v -f /tmp/1.txt /tmp/2.txt`
echo "Adding iSCSI datastore ${new_disk}"
if [[ ! -z $new_disk ]]; then
echo "format and configure datastore"
list=`ls /vmfs/devices/disks/naa* | grep -v ':'`
@huskercane
huskercane / pure_old_kernel.sh
Created December 3, 2014 18:49
Purge old ubuntu kernel
dpkg -l 'linux-*' | awk '/^ii/{ print $2}' | grep -v -e `uname -r | cut -f1,2 -d"-"` | grep -e '[0123456789]' | grep -E "(image|headers)" | xargs sudo apt-get -y purge
@huskercane
huskercane / groovy.sublime.-build
Created November 12, 2014 18:54
Run groovy script from sublime text 3 Tools -> Build System -> New Build System, Paste below and save as groovy.sublime-build
{
"cmd": ["groovy","$file"],
"selector": "source.groovy",
"file_regex": "[ ]*at .+[(](.+):([0-9]+)[)]",
}
@huskercane
huskercane / WinkClient.java
Created November 6, 2014 01:36
Java class to trust all certs and hosts, needs wink and apache http 1.4
import java.net.URI;
import javax.ws.rs.core.UriBuilder;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.conn.ssl.SSLContextBuilder;
import org.apache.http.conn.ssl.TrustSelfSignedStrategy;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.wink.client.ClientResponse;
@huskercane
huskercane / enable_winrm.ps1
Created November 6, 2014 01:31
Enable winrm from a provision script like in softlayer
# configure WinRM
Set-WSManQuickConfig -Force
Set-Item WSMAN:\LocalHost\MaxTimeoutms -Value "1800000"
Set-Item WSMAN:\LocalHost\Service\AllowUnencrypted -Value $true
Set-Item WSMAN:\LocalHost\Service\Auth\Basic -Value $true
Set-Item WSMAN:\LocalHost\Client\Auth\Basic -Value $true
Set-Item WSMan:\Localhost\Client\TrustedHosts -Value "*" -Force
Set-Service WinRM -startuptype "automatic"