Skip to content

Instantly share code, notes, and snippets.

orangeblock /
Last active Mar 28, 2021
Run as `python3 /path/to/normalize`. Renames all files and subdirectories at specified root to be UNIX-friendly and not require any quoting.
import os
import re
import sys
PATH = sys.argv[1]
except IndexError:
print("Usage: %s /path/to/normalize" % sys.argv[0])
orangeblock / portcheck.ps1
Last active Mar 27, 2021
Powershell script to check which hosts have a port open. You can use it without any arguments to scan local addresses [ -] for port 22, or use the arguments at the top to specify various properties.
View portcheck.ps1
[string]$HostPrefix = "192.168.1.",
[int]$Port = 22,
[int]$StartIndex = 2,
[int]$EndIndex = 30,
[int]$ConnectTimeout = 150
function testport ($hostname, $port, $timeout) {
$client = New-Object System.Net.Sockets.TcpClient
orangeblock /
Last active Dec 23, 2018
Customizable concurrent URL downloader. Works with Python 2.7x and 3.x, only using core libraries. Can be ran as a command line script or used as a library. Simply pass a list of URLs to download_files. For the rest simply read the docstring or --help from the CL.
import os
import sys
import csv
import time
import shutil
from multiprocessing.dummy import Pool as ThreadPool
from collections import Iterable
orangeblock /
Last active Mar 22, 2020
GitHub webhook listener, using netcat and bash. `` and `` must be in the same directory. Start with `./ <port> <path-to-script> [<endpoint>]`. All files (including scripts) must be executable.
# parse endpoint (only works for POST)
read request
url="${request#POST }"
url="${url% HTTP/*}"
# change this!!!