Skip to content

Instantly share code, notes, and snippets.

' DESCRIPTION:
' This script will backup bitlocker recovery information to active directory for drives which are already encrypted.
' DEVELOPED BY:
' Himanshu Singh ([email protected])
' Microsoft Corporation
' Patched by Evgeny Varnavskiy
' Sep 2018
#!/bin/sh
# Delete older than n days
find /var/spool/asterisk/monitor -mtime +75 -name '*.mp3' -delete
#Delete files smaller than n K
find /var/spool/asterisk/monitor -size -30k -name '*.mp3' -delete
A QA engineer walks into a bar, and orders a beer.
Then he orders 0 beers.
Then he orders 999999999999 beers.
Then he orders an aardvark.
Then he orders nothing.
Then he orders -1 beers.
A giant ship engine failed. The ship’s owners tried one expert after another, but none of them could figure out how to fix the engine.
Then they brought in an old man who had been fixing ships since he was young. He carried a large bag of tools with him, and when he arrived, he immediately went to work. He inspected the engine very carefully, top to bottom.
Two of the ship’s owners were there, watching this man, hoping he would know what to do. After looking things over, the old man reached into his bag and pulled out a small hammer. He gently tapped something. Instantly, the engine lurched into life. He carefully put his hammer away. The engine was fixed!
A week later, the owners received a bill from the old man for ten thousand dollars.
“What?!” the owners exclaimed. “He hardly did anything!”
So they wrote the old man a note saying, “Please send us an itemized bill.”
The man sent a bill that read:
Tapping with a hammer………………….. $ 2.00
Knowing where to tap…………………….. $ 9,998.00
@varnav
varnav / ad_users_to_file.ps1
Last active August 22, 2017 09:18
Export Active Directory users to simple txt file, one user per line
Get-ADUser -SearchBase "DC=domain,DC=local" -Filter {(mail -ne "null") -and (Enabled -eq "true")} | Format-Table -HideTableHeaders SamAccountName | Out-File d:\aduserlist.txt
@varnav
varnav / gzip_static_generate.sh
Last active February 24, 2018 09:35
Compress website assets for serving by gzip static nginx plugin.
#!/usr/bin/env zsh
# https://gist.github.com/Eriner/6be8c43d8aff8134f7d8fb547612aadf
filetypes=(html xml css)
zcomp() {
print "zopfli compressing ${1}"
for file in ./_site/**/*.${1}; do
zopfli --i1000 ${file}
done
@varnav
varnav / mp3_cleanup.sh
Created May 17, 2017 11:07
Clean up old mp3 records
#!/bin/sh
#find . -mtime +90 -exec mv {} /monitor/mp3/todelete \;
# Delete older than n days
find /monitor/mp3/ -mtime +60 -delete
find /backups/ -mtime +180 -type f -delete
#Delete files smaller than n K
find /monitor/mp3/ -size -30k -type f -delete
It kinda went like this...
In the beginning there were developers, testers, sysadmins, dba's, network engineers, and at bigger places operators. By 'beginning' I mean like, a decade ago for where I worked, some places its still this way today.
This was not a good or natural state of affairs, its just how things were given the tech & talent at the time. It also required a business be big & successful enough to hire some number of people for those roles. Most places there was not a small amount of tension between devs and sysadmins.
Then the cloud happened. It ate away at the bottom 50% of what sysadmins did, the bottom 20% of what dba's did, and 80% of what network engineers did. At the same time the growth in scripting languages and a mantra of "automate everything" led to most of what testers and operators did getting replaced with scripts and cron jobs (or nowadays jenkins).
That meant that sysadmins had to shift focus up a half-layer and change their attitude from one of protecting the users and the bu
What do I do?
System architecture.
Networking and security.
No one in this house can touch me on that.
While you were busy minoring in gender studies and singing a capella at Sarah Lawrence,
I was gaining root access to NSA servers.
I was one click away from starting a second Iranian revolution.
I prevent cross-site scripting, I monitor for DDoS attacks, emergency database rollbacks, and faulty transaction handlings.
@varnav
varnav / post_load.py
Created March 16, 2017 10:41
POST load testing
#!/usr/bin/python3
# POST load testing script
# Eugene Varnavsky 2017
# MIT License
from urllib.parse import urlencode
from urllib.request import Request, urlopen
import urllib
import _thread