Skip to content

Instantly share code, notes, and snippets.

View TheRockStarDBA's full-sized avatar
🏠
Working from home

Kin Shah TheRockStarDBA

🏠
Working from home
View GitHub Profile
@eyeseast
eyeseast / python.md
Last active November 6, 2023 01:32
How to set up Python in 2022

I have an updated version of this on my blog here: https://chrisamico.com/blog/2023-01-14/python-setup/.

Python

This is my recommended Python setup, as of Fall 2022. The Python landscape can be a confusing mess of overlapping tools that sometimes don't work well together. This is an effort to standardize our approach and environments.

Tools and helpful links:

  • Python docs: https://docs.python.org/3/
  • Python Standard Library:  - Start here when you're trying to solve a specific problem
@TheRockStarDBA
TheRockStarDBA / postgres_resources.md
Last active December 10, 2020 22:12
Postgres Index - resources
@TheRockStarDBA
TheRockStarDBA / ExponentialBackoffDemo.ps1
Created August 18, 2020 01:41 — forked from JustinGrote/ExponentialBackoffDemo.ps1
Powershell Exponential Backoff. Replace "Connect-ExchangeOnline" with whatever
for ($i=1;$i -le 5;$i++) {
try {
Connect-ExchangeOnline -Credential $Credential -Verbose:$false -ShowProgress $false -Force -WarningAction silentlycontinue 6>$null
} catch {
if ($i -ge 2) {Write-Warning "Connect-ExchangeOnline Retry $i"}
[float]$sleepTimer = [Math]::Pow(2,$i) + [float]((Get-Random -Max 1000) /1000 )
Write-Warning "Connect-ExchangeOnline PS Remoting Error (retry: $sleeptimer sec): $PSItem"
Start-Sleep $sleeptimer
continue
}
@haranjackson
haranjackson / scrapy_lambda_layer.sh
Last active May 7, 2022 09:24
Deploys Python Scrapy library to an AWS Lambda layer. You can specify the region, library version, and runtime.
REGION=eu-west-1
VER=1.7.3
RUNTIME=python3.7
docker run -v $(pwd):/out -it lambci/lambda:build-$RUNTIME \
pip install scrapy==$VER -t /out/build/scrapy/python
cd build/scrapy
zip -r ../../scrapy.zip python/
cd ../..
@TheRockStarDBA
TheRockStarDBA / latency.txt
Created September 5, 2018 15:24 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@TheRockStarDBA
TheRockStarDBA / Get-AmIPwned.ps1
Created February 22, 2018 03:49 — forked from lzybkr/Get-AmIPwned.ps1
Script to query passwords reported to haveibeenpwned.com
<#
.SYNOPSIS
Reports if your password is pwned by querying haveibeenpwned.com
.DESCRIPTION
Query haveibeenpwned.com to see if a password has appeared in a breach.
The query sends the first 5 characters of the SHA1 hash, so the query should be considered safe and anonymous.
@nohwnd
nohwnd / Uninstall-Pester.ps1
Last active March 14, 2024 13:57
Remove built-in version of Pester 3 (or -All) from Windows 10 Program Files and Program Files (x86).
#Requires -RunAsAdministrator
function Uninstall-Pester ([switch]$All) {
if ([IntPtr]::Size * 8 -ne 64) { throw "Run this script from 64bit PowerShell." }
#Requires -RunAsAdministrator
$pesterPaths = foreach ($programFiles in ($env:ProgramFiles, ${env:ProgramFiles(x86)})) {
$path = "$programFiles\WindowsPowerShell\Modules\Pester"
if ($null -ne $programFiles -and (Test-Path $path)) {
if ($All) {
@refactorsaurusrex
refactorsaurusrex / appendAllLines.ps1
Last active August 1, 2023 12:53
How to call 'File.AppendAllLines' with PowerShell
$path = 'C:\text.txt'
$output = 'This is an output string'
# This works...
[System.IO.File]::WriteAllLines($path, $output)
# But this doesn't. WTF!
[System.IO.File]::AppendAllLines($path, $output)
# Result: 'Cannot find an overload for "AppendAllLines" and the argument count: "2".'