This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python2 | |
| #Squelch matplotlib / seaborne error | |
| import warnings | |
| warnings.filterwarnings("ignore") | |
| import matplotlib | |
| import matplotlib.pyplot as plt | |
| import pandas | |
| import MySQLdb |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Taken from: http://scriptorium.serve-it.nl/view.php?sid=68 | |
| #and | |
| #https://www.mrexcel.com/forum/excel-questions/391426-ping-list-servers-excel.html | |
| Option Explicit | |
| 'Requires references to Microsoft Scripting Runtime and Windows Script Host Object Model. | |
| 'Set these in Tools - References in VB Editor. | |
| Public Function PingResult(sHost As String) As String |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Copied from https://www.geekality.net/2016/03/07/excel-function-for-nslookup-in-worksheet/ | |
| #Usage: Given an IP in cell A1, to get the hostname: =NSLookup(A1; 2) | |
| Public Function NSLookup(lookupVal As String, Optional addressOpt As Integer) As String | |
| Const ADDRESS_LOOKUP = 1 | |
| Const NAME_LOOKUP = 2 | |
| Const AUTO_DETECT = 0 | |
| 'Skip everything if the field is blank | |
| If lookupVal <> "" Then | |
| Dim oFSO As Object, oShell As Object, oTempFile As Object |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #1 | |
| : sysctl -a | egrep -i 'hw.machine|hw.model|hw.ncpu' | |
| hw.machine: amd64 | |
| hw.model: Intel(R) Celeron(R) CPU 1037U @ 1.80GHz | |
| hw.ncpu: 2 | |
| hw.machine_arch: amd64 | |
| #2 Test for temp | |
| :/sbin/sysctl hw.acpi.thermal.tz0.temperature | |
| :/sbin/sysctl -a | grep "^dev.*0.temperature" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Brute Find | |
| #Use: | |
| #sudo ./brutefind.sh > /dev/null 2>&1 | |
| #find /sys/ -type f | while read f; do | |
| #find /proc/ -type f | grep -v '/proc/^[0-9]\{5\}$' | while read f; do | |
| find /proc/ -type f | while read f; do | |
| #Grep quietly on the results (read f) of files. Count the numbers, contained within. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| View Images - basic - numbered | |
| --------------------------------------------------------- | |
| <?php | |
| $files = glob("*.jpg"); | |
| /* for ($i=1; $i<count($files); $i++) */ | |
| for ($i=1; $i<=10; $i++) | |
| { | |
| $num = $files[$i]; | |
| list($width, $height, $type, $attr) = getimagesize("'.$num.'"); | |
| $fn = getimagesize("'.$num.'"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| #Pre-requisites: file named hourly_temp, smtp client | |
| #touch hourtemp_email | |
| cat /dev/null>/home/pi/hourtemp_email | |
| hourlytemp=$(awk '{print $1/1000 * 1.8 + 32}' /sys/class/thermal/thermal_zone0/temp | awk '{printf("%d\n",$1 + 0.5)}') | |
| export [email protected] | |
| export [email protected] | |
| export sensorsubject=TEMP:$hourlytemp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| %matplotlib inline | |
| import time | |
| import os | |
| import glob | |
| import seaborn as sns | |
| import numpy as np | |
| import pandas as pd | |
| import matplotlib.pylab as plt | |
| from matplotlib import rcParams | |
| rcParams.update({'figure.autolayout': False}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| #import glob | |
| #import time | |
| path = "C:/path/to?files/*.csv" | |
| for fname in glob.glob(path): | |
| temp1=os.path.basename(os.path.normpath(fname)) | |
| filename=temp1.split('.')[0] | |
| dt=time.strftime('%Y%m%d', time.gmtime(os.path.getmtime(fname))) | |
| print(filename+","+dt) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| #Change csv to match the file extension you are searching for | |
| path = "C:/path/to/files/*.csv" | |
| for fname in glob.glob(path): | |
| temp1=os.path.basename(os.path.normpath(fname)) | |
| filename=temp1.split('.')[0] | |
| print(filename) |