Skip to content

Instantly share code, notes, and snippets.

@tascrafts
tascrafts / certificate_checker.php
Created May 17, 2023 11:07
A PHP script to check and display SSL certificate expiration in Google and .ical calendars
<?php
$urls[] = array(
"name" => "Domain 1 Name",
"url" => "https://domain.com"
);
$urls[] = array(
"name" => "Domain 2 Name",
"url" => "https://subdomain.domain.org"
@tascrafts
tascrafts / sslgoogcal.php
Created December 25, 2021 13:08
Script to add SSL expiration dates to Google Calendar
<?php
$url = "https://yourdomain.com";
$orignal_parse = parse_url($url, PHP_URL_HOST);
$get = stream_context_create(array("ssl" => array("capture_peer_cert" => TRUE)));
$read = stream_socket_client("ssl://".$orignal_parse.":443", $errno, $errstr, 30, STREAM_CLIENT_CONNECT, $get);
$cert = stream_context_get_params($read);
$certinfo = openssl_x509_parse($cert['options']['ssl']['peer_certificate']);
$output = $certinfo['validTo_time_t'];
@tascrafts
tascrafts / Show Wi-Fi Passwords.ps1
Created April 14, 2020 12:42
Lists all saved wi-fi networks and passwords on Windows 10
(netsh wlan show profiles) | Select-String “\:(.+)$” | %{$name=$_.Matches.Groups[1].Value.Trim(); $_} | %{(netsh wlan show profile name=”$name” key=clear)} | Select-String “Key Content\W+\:(.+)$” | %{$pass=$_.Matches.Groups[1].Value.Trim(); $_} | %{[PSCustomObject]@{ PROFILE_NAME=$name;PASSWORD=$pass }} | Format-Table -AutoSize
pause
@tascrafts
tascrafts / default.php
Created September 19, 2019 17:26
Default HTML file with headers and bootstrap
<?php
// PHP content here.
?><!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
@tascrafts
tascrafts / simple_sma.php
Created May 24, 2018 14:55
Simple Moving Average function for PHP
<?php
// Example
$sma_array = simple_sma(array(3,10,11,19,18,12,6,5,9,0), 5);
print_r($sma_array); // Outputs 8, 13.3333, 16, 16.3333, 12, 7.6667, 6.6667, 4.6667
function simple_sma($array, $days) {
if($days < 0) die("Days have to be higher than 0 in the simple_sma function.");
$array = array_values($array);