Skip to content

Instantly share code, notes, and snippets.

View chrisdpa-tvx's full-sized avatar

Chris Atkinson chrisdpa-tvx

View GitHub Profile
@chrisdpa-tvx
chrisdpa-tvx / sendmail.py
Created March 12, 2018 15:04
Send Mail using docker as a relay
#!/usr/bin/env python3
# Start a mail relay using docker:
#
# docker run -p 25:25 namshi/smtp
#
import smtplib
from email.message import EmailMessage
from email.headerregistry import Address
@chrisdpa-tvx
chrisdpa-tvx / Resize-PartitionMax.ps1
Created March 27, 2018 11:10
AWS Resize a windows volume
Resize-Partition -DiskNumber 3 -PartitionNumber 2 -Size $((get-disk -Number 3 | Get-PartitionSupportedSize -PartitionNumber 2).sizemax)
@chrisdpa-tvx
chrisdpa-tvx / python_update.rst
Last active April 19, 2018 08:04
Updating Python 2.7 to use TLS1.2

Updating python to use TLS1.2 is now required (this is the problem the guys in devops encountered) and here is how to do it.

If you are using virtualenv you’ll need to deactivate it:

deactivate

then use brew to install the latest version of python and openssl:

brew install python@2
@chrisdpa-tvx
chrisdpa-tvx / Unix to powershell Cheatsheet.rst
Last active October 10, 2018 15:45
Cross over commands for those forced to use powershell

Recursive Grep

unix:

grep -R 'bruce'

Powershell

@chrisdpa-tvx
chrisdpa-tvx / capybara cheat sheet
Last active June 28, 2018 08:42 — forked from zhengjia/capybara cheat sheet
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@chrisdpa-tvx
chrisdpa-tvx / entropy.py
Last active July 16, 2018 15:01
Hide high entropy strings
#!/usr/bin/python -u
import math
import sys
def entropy(string):
prob = [float(string.count(c)) / len(string) for c in dict.fromkeys(list(string))]
return - sum([p * math.log(p) / math.log(2.0) for p in prob])
@chrisdpa-tvx
chrisdpa-tvx / install_java.ps1
Last active June 1, 2021 18:00
Install Java JRE on windows silently using powershell
$URL=(Invoke-WebRequest -UseBasicParsing https://www.java.com/en/download/manual.jsp).Content | %{[regex]::matches($_, '(?:<a title="Download Java software for Windows Online" href=")(.*)(?:">)').Groups[1].Value}
Invoke-WebRequest -UseBasicParsing -OutFile jre8.exe $URL
Start-Process .\jre8.exe '/s REBOOT=0 SPONSORS=0 AUTO_UPDATE=0' -wait
echo $?