Skip to content

Instantly share code, notes, and snippets.

View Kevin7020's full-sized avatar
:atom:
Inverted vertical reversement

Kevin Porras Rowe Kevin7020

:atom:
Inverted vertical reversement
View GitHub Profile
@Kevin7020
Kevin7020 / run.psd1
Created July 12, 2020 23:32
POST request using powershell and a dynamic JSON body to a discord webhook
# Base post example taken from here https://www.jokecamp.com/blog/invoke-restmethod-powershell-examples/
function Send-DiscordNotif($text, $webhook) {
$json = @{
content=$text
}
$body = $json | ConvertTo-Json
$response = Invoke-RestMethod -Method Post -Uri $webhook -Body $body -ContentType 'application/json'
$response
}
@Kevin7020
Kevin7020 / crontab
Created June 2, 2020 02:48
Crontab to run the script md5.sh every hour
# You'll need to run ($sudo crontab -e)
# since the script needs root permisions to modify and create the current_users at /var
0 * * * * /home/kevin/md5.sh
@Kevin7020
Kevin7020 / md5.sh
Last active May 30, 2020 05:59
A shell script that will take the passwd file create an MD5 out of the user and its home folder and then its going to log changes on the current_users file (Needs root permisions))
#!/bin/bash
if [ -e /var/log/current_users ]
then
#TODO check last MD5
echo "Last MD5 found"
lastHash=$( awk 'NR==1{print $1; exit}' /var/log/current_users ) #Use awk to take only the hash at the top of the file
newHash=$( awk -F : '{print $1":"$6}' /etc/passwd | md5sum | awk '{print $1}' ) #Check the processed passwd file to gather the current MD5 print
echo 'Last: '$lastHash 'New: '$newHash
if [ $lastHash = $newHash ]
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
const char* ssid = "..............";
const char* password = "................";
String form = "<form action='led'><input type='radio' name='state' value='1' checked>On<input type='radio' name='state' value='0'>Off<input type='submit' value='Submit'></form>";
String imagepage = "<img src='/led.png'>";