Skip to content

Instantly share code, notes, and snippets.

@pmolchanov
pmolchanov / parseCraigslistRssFeed.py
Created January 19, 2016 07:42
Parse Craigslist RSS Feed
from lxml import etree
def parseCraigslistRssFeed(url):
listings = []
xml = etree.parse(url)
channel = xml.getroot().find('{*}channel')
items = xml.getroot().findall('{*}item')
for item in items:
title = item.find('{*}title').text
desc = item.find('{*}description').text
@pmolchanov
pmolchanov / ExecWithFileMonitoring.sh
Created December 5, 2015 14:24
Run a command and see what files were changed
find / -xdev -printf '%p\t%c\n' | sort > /tmp/before
# Do some command here!!!
find / -xdev -printf '%p\t%c\n' | sort > /tmp/after
diff -u /tmp/before /tmp/after | less
rm /tmp/before
rm /tmp/after
@pmolchanov
pmolchanov / sd-fbn-search
Created October 14, 2015 21:34
San Diego Fictitious Business Name search from the command line!
@pmolchanov
pmolchanov / PoshWebHarness.ps1
Created June 18, 2015 17:13
Simple PowerShell HTTP/HTTPS web server useful for mocking web services
# Use the following commands to bind/unbind SSL cert
# netsh http add sslcert ipport=0.0.0.0:443 certhash=3badca4f8d38a85269085aba598f0a8a51f057ae "appid={00112233-4455-6677-8899-AABBCCDDEEFF}"
# netsh http delete sslcert ipport=0.0.0.0:443
$HttpListener = New-Object System.Net.HttpListener
$HttpListener.Prefixes.Add("http://+:80/")
$HttpListener.Prefixes.Add("https://+:443/")
$HttpListener.Start()
While ($HttpListener.IsListening) {
$HttpContext = $HttpListener.GetContext()
$HttpRequest = $HttpContext.Request
@pmolchanov
pmolchanov / InstallSerivice.ps1
Created May 13, 2015 07:29
Install a service
$ServiceExe = "MyService.exe"
$ServiceName = "MyService"
$ServiceDisplayName = "MyService DisplayName"
$ServiceBinPath = [System.IO.Path]::GetFullPath($ServiceExe)
& sc.exe delete $ServiceName
& sc.exe create $ServiceName binPath= "`"$ServiceBinPath`"" DisplayName= "`"$ServiceDisplayName`""
& sc.exe start $ServiceName
@pmolchanov
pmolchanov / FindLargeFiles.ps1
Created April 1, 2015 22:29
Finds large files on your C: drive
Get-ChildItem C:\ -Recurse -ErrorAction 'silentlycontinue' | Where-Object {$_.Length -gt 100MB} | Sort-Object -Property Length -Descending | Select-Object -First 10 | Format-Table -AutoSize -Wrap -Property FullName,Length | Out-String -Width 4096 | Out-File "foo.txt"