Skip to content

Instantly share code, notes, and snippets.

using BITS = BITSReference1_5;
namespace ConsoleApp2
{
class Program
{
class BISTJobObject
{
static BITS.BackgroundCopyManager1_5 BITSManager;
static BITS.GUID JobGUID;
@M507
M507 / Upgrade-wget-Centos-7.sh
Last active August 12, 2024 12:22
Upgrade wget to 1.20.3 on Centos
yum groupinstall "Development Tools" -y
yum install gcc glibc glibc-common gd gd-devel openssl -y
yum install glibc-devel glibc-headers kernel-headers kernel-devel gnutls-devel -y
cd /opt
wget https://ftp.gnu.org/gnu/wget/wget-1.20.3.tar.gz
./configure
make
cd src/
cp wget /usr/bin/wget
cd ~/
@ECHO OFF
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -nologo -noProfile -NonInteractive -ExecutionPolicy bypass -File \\domain.com\sysvol\domain.com\Policies\{000000000000000000}\USER\Scripts\Logon\slack-auth.ps1
@M507
M507 / windows-slack-notifications.ps1
Created November 4, 2020 21:00
Windows auth notifier - Slack
$out = 'Info: '+ (whoami) + ' logged into ' + (hostname)
$body = @(
@{
text = $out
}
)
$JSON = $body | ConvertTo-Json
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Invoke-RestMethod -Uri "[Webhook URL]" -Method Post -Body $JSON -ContentType "application/json"
@M507
M507 / pfsense-slack-notifications.sh
Created November 4, 2020 19:43
pfsense service checker - Slack
#!/bin/sh
for value in arpwatch dhcpd dpinger ntpd openvpn syslogd unbound
do
pfSsh.php playback svc status $value | grep stopped
if [ $? -eq 0 ]
then
out="Important alert from "`hostname`": service $value is down!"
echo $out
curl -X POST -H 'Content-type: application/json' [Webhook URL] --data "{\"text\": \"${out}\"}"
fi
# /bin/bash
echo "deb http://httpredir.debian.org/debian stretch-backports main" | sudo tee -a /etc/apt/sources.list.d/stretch-backports.list
apt-get update
cd /tmp
wget -O - https://debian.neo4j.com/neotechnology.gpg.key | sudo apt-key add -
echo 'deb https://debian.neo4j.com stable 4.0' > /etc/apt/sources.list.d/neo4j.list
apt update -y
apt install apt-transport-https -y
apt install neo4j -y
cd /usr/bin
@M507
M507 / gist:5247f27556e80bb2cc5e5c181e44e6a9
Last active February 3, 2021 05:33
Install packer on Mac
# Install Homebrew on Mac
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Install packer
brew install packer
# Set packer's env variables
echo "
export PACKER_PLUGIN_PATH="~/.packer.d/plugins"
export PACKER_CONFIG_DIR="~/.packer.d"
" >> ~/.zshrc