Skip to content

Instantly share code, notes, and snippets.

View hirman74's full-sized avatar

hirman hirman74

  • Singapore
  • 13:50 (UTC +08:00)
View GitHub Profile
@hirman74
hirman74 / ping.py
Last active May 7, 2023 08:03 — forked from Symeon-Carle/ping.py
async ping for python 3 on Windows
import asyncio
WaitTimeOut = 600 # -w milliseconds
PingProbe = 10 # -n
PingSize = 65500 # -l
## for Mac 'macosx'
## PingSize = 8184 # -s plus 8 bytes of ICMP header
ParallelPing = 100 # Concurrent ping stream
@hirman74
hirman74 / walkerMinute.js
Last active September 13, 2023 04:39
Per Minute SNMPwalk
var IPHosts = ["192.168.13.128"];
var cmdSNMP = '.\\bin\\snmpwalk.exe -v 2c -c public -r 2 -t 1 -Ovqs -M .\\UPSonlyMIBS\\ ';
var SNMPBranch = ['.1.3.6.1.2.1.1.3'];
//run cscript snmpPoller_007.js
function returnMinutesDate () {
var today = new Date();
return (today.getFullYear() + "" + (today.getMonth()+1) + "" + today.getDate() + "" + today.getHours() + "" + today.getMinutes())
}
@hirman74
hirman74 / tkinter_PyEZ.py
Created November 5, 2022 10:28
From DO_PyEZ_Cookbook.pdf successful tkinter
'''
C:\Python389\python.exe -m pip install --upgrade pip
C:\Python389\Scripts\pip3.8.exe install virtualenv
C:\Python389\python.exe -m virtualenv -p="C:\Python389\python.exe" virtenv
Activate.bat
C:\Python389\Scripts\pip3.8.exe install junos-eznc
C:\Python389\python.exe
From https://www.juniper.net/documentation/en_US/day-one-books/DO_PyEZ_Cookbook.pdf
Recipe 14 - Adding a Graphical Interface to the PyEZ Script by Peter Klimai
strComputer = "."
Dim objShell, objWMIService
Set objShell = WScript.CreateObject("WScript.Shell")
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Dim colItems, NumS, MemorySize, CPU1, CPU2, ProcessId, strProcess, strProcessKill, MemorySize1, MemorySize2, AverageCPU
Wscript.Sleep 10000
strProcessKill = "'TASKMGR.EXE'"
Set colItems = objWMIService.ExecQuery("Select * From Win32_Process Where Name = " & strProcessKill)
@hirman74
hirman74 / pfiles_netstat.html
Last active September 13, 2023 04:39
HTML application page to assist in generating "pfiles" command and extract the info for "netstat" count of relevant open session to external host.
<!DOCTYPE html>
<head>
<title>pfiles process port finder</title>
<!--<meta http-equiv="x-ua-compatible" content="ie=11"/>-->
<!--<meta http-equiv="x-ua-compatible" content="ie=edge" />-->
<meta http-equiv="X-UA-Compatible" content="IE=9; IE=8; IE=7">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta charset="UTF-8">
@hirman74
hirman74 / downloadNEARainfallGeoMRT.py
Created March 9, 2021 22:07
From NEA Rainfall data sensor location distance to DTL MRT Stations
import requests
import json
import os
from datetime import timedelta, date
from math import radians, cos, sin, asin, sqrt
def haversine(lon1, lat1, lon2, lat2):
"""
Calculate the great circle distance between two points
on the earth (specified in decimal degrees)
@hirman74
hirman74 / CiscoKeyGen.py
Last active September 29, 2023 10:52 — forked from paalfe/CiscoKeyGen.py
This is a fork of Cisco IOU License Generator to run on Mac OSX. Make the file executable with " chmod +x CiscoKeyGen.py " and execute it " ./CiscoKeyGen.py ".
#! /usr/bin/python
print "\n*********************************************************************"
print "Cisco IOU License Generator - Kal 2011, python port of 2006 C version"
import os
import socket
import hashlib
import struct
# get the host id and host name to calculate the hostkey
#hostid=os.popen("hostid").read().strip() # for linux
hostid=str(os.popen('hostid')).split()[-1][2:-1] # for Mac OSX 10.9.3 Python 2.7.5