Skip to content

Instantly share code, notes, and snippets.


Raymond Piller VertigoRay

View GitHub Profile
VertigoRay /
Last active Jun 16, 2018
Changed my mind and made this a repo:
VertigoRay / interfaces
Created Jul 11, 2017
Ubuntu Server: Bonding Adaptive Load Balancing
View interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
VertigoRay / Django: User Email Validation without a DB
Last active May 17, 2016
Typically, when you want to validate an e-mail address, you store an activation key and expiration date in the user profile table. So you can validate it one time. Then what? Just keep storing it forever? Clear it out and have the empty columns? I wanted a disposable key that didn't have to be stored in a database. This is my solution ... http:/…
View Django: User Email Validation without a DB
C:\Temp>env\Scripts\python.exe shell
Python 3.5.1 (v3.5.1:37a07cee5969, Dec 6 2015, 01:54:25) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from myapp.settings import EMAIL_KEY_EXPIRY_TIME
>>> from user.helpers import signing_dumps_w_entropy, signing_loads_w_entropy, get_uri
>>> import urllib.parse
>>> email = ''
>>> key = signing_dumps_w_entropy(email)
View CloudStation_Rename_Errors.ps1
[System.Collections.ArrayList] $already_done = @()
Get-Content .\AppData\Local\CloudStation\log\daemon.log -Wait | ?{ $_ -match '\[ERROR\]' } | %{
$_ -match '(\\Users\\[^\\]+\\CloudStation\\[^\]]+)' | Out-Null
if ($Matches[1] -and ($already_done -inotcontains $Matches[1])) {
Write-Host ($Matches[1] | Out-String)
Rename-Item (Resolve-Path $Matches[1]) "_$(Split-Path $Matches[1] -Leaf)"
while (-not (Test-Path $Matches[1])) {
Start-Sleep -Seconds 1
Remove-Item "$(Split-Path $Matches[1] -Parent)\_$(Split-Path $Matches[1] -Leaf)" -Force
VertigoRay / ForEachSpeeds.Tests.ps1
Last active Aug 22, 2021
Used Pester to do some speed tests, because the comments on my stackoverflow post ( peaked my interest.
View ForEachSpeeds.Tests.ps1
Invoked the test with the following command, so that I could save the times take the average of each Context:
Invoke-Pester -OutputFile test.xml -OutputFormat NUnitXml
Then I did some math on the results as shown (yes, I use pipelines when not scripting):
VertigoRay / Pause.ps1
Created Feb 4, 2015
Mimics the command prompt Pause command.
View Pause.ps1
Mimics the command prompt Pause command.
Powershell doesn't have a Pause command that Prompts the user with "Press any key to continue..." and waits for a response.
This brings that command to PowerShell and allows you to customize the message.
The paused Message can be customzied by passing a string.
VertigoRay / Get-FileEncoding.ps1
Last active Aug 29, 2015
Get-FileEncoding function determines encoding by looking at Byte Order Mark (BOM).
View Get-FileEncoding.ps1
Gets file encoding.
The Get-FileEncoding function determines encoding by looking at Byte Order Mark (BOM).
Based on port of C# code from
The Path of the file that we want to check.
VertigoRay / CatchLineNumbers.ps1
Last active Jan 15, 2017
The `$MyInvocation.ScriptLineNumber` variable is not the Current Line Number. It’s the Line number from where the function that you’re in was called. Actual line numbers can be caught for an error if you catch them. Used in this comment:
View CatchLineNumbers.ps1
function a {
[string]$UninstallString = 'thing'
Write-Host -Fore Cyan "$($here.File) $($MyInvocation.MyCommand):$($MyInvocation.ScriptLineNumber)"
try {
VertigoRay / Write-Json
Last active Aug 29, 2015
Write a Json object in human readable format. The `$json` parameter expects a Json object, returned from `ConvertFrom-Json`. More Info:
View Write-Json
function Write-Json {
HelpMessage = "Json object to be printed out in human readable format."
VertigoRay / pre-commit
Created Mar 25, 2014
Test pre-commit hook
View pre-commit
# Line to test if POSH is even executing
/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe -Command "Get-Location | Out-File C:\Temp\test.txt"
if /c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe -Command "If ((Get-AuthenticodeSignature .\install.ps1).Status -ne 'Valid') { Exit 1 }"
cat <<\EOF
The install.ps1 file has a valid signature.