Skip to content

Instantly share code, notes, and snippets.

View discarn8's full-sized avatar

discarn8 discarn8

View GitHub Profile
@discarn8
discarn8 / Raspberry_PI_Email_TEMP.sh
Created January 14, 2019 07:27
Raspberry_Pi_Hourly_Temp_email
#!/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 smtpemailfrom=user@domain.com
export sensormailto=recipient@gmail.com
export sensorsubject=TEMP:$hourlytemp
@discarn8
discarn8 / view_images.php
Created January 18, 2019 05:08
PHP View images in a Directory
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.'");
@discarn8
discarn8 / Brute_Find.sh
Last active February 4, 2019 05:36
Brute_Find.sh
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.
@discarn8
discarn8 / FreeBsd_Nagios_CPU_Temp_Wrapper.sh
Last active January 21, 2019 10:01
FreeBsd_Nagios_CPU_Temp_Wrapper
#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"
@discarn8
discarn8 / nslookup.vba
Created January 30, 2019 22:15
nslookup.vba
#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
@discarn8
discarn8 / ping.vba
Last active May 9, 2023 04:45
ping.vba
#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
@discarn8
discarn8 / stocks_to_png.py
Last active February 4, 2019 06:27
Python2.7 script to pull your favorite stock and graph it (currently - 5 day trend)
#!/usr/bin/env python2
#Squelch matplotlib / seaborne error
import warnings
warnings.filterwarnings("ignore")
import matplotlib
import matplotlib.pyplot as plt
import pandas
import MySQLdb
@discarn8
discarn8 / stock_to_mysql.sh
Created February 4, 2019 06:26
Bash script to pull stock price and drop it to mysql table
#!/bin/bash
#The mysql connection string shown, assumes you are using a .cnf file in your home directory
# Set set -xv to enable script debugging
#set -xv
ds=0
i=0
#Pull the current stock price from the nasdaq site
@discarn8
discarn8 / install_UFW_pi.sh
Created February 7, 2022 04:47
BASH: Automate UFW installation on Raspberry Pi
#!/bin/bash
# **************************************************
# FILENAME: install_UFW.sh
# DATE: DEC 2021
# AUTHOR: RCombs
#
# PURPOSE: Install UFW on Raspberry Pi
# **************************************************
@discarn8
discarn8 / install_mysql_pi.sh
Last active June 7, 2022 15:49
BASH: Install MYSQL On Raspberry Pi
#!/bin/bash
# *********************************************
# FILENAME: install_mysql_pi.sh
# DATE: Sep 2021
# AUTHOR: RCombs
#
# PURPOSE: Install mysql Client on Raspberry Pi
# *********************************************