Skip to content

Instantly share code, notes, and snippets.

ZSH CheatSheet

This is a cheat sheet for how to perform various actions to ZSH, which can be tricky to find on the web as the syntax is not intuitive and it is generally not very well-documented.

Strings

Description Syntax
Get the length of a string ${#VARNAME}
Get a single character ${VARNAME[index]}
@MCOfficer
MCOfficer / odd_batch.py
Last active November 14, 2020 13:27
OpenDirectoryDownloader batch scanning
# Reads URLs from to_scan.txt, one URL per line.
# Outputs the reddit-formatted results to results.txt
import subprocess
import os
with open("to_scan.txt", "r") as f:
urls = [line.strip() for line in f.readlines()]
print("Scanning %s URLs" % len(urls))
@Jwink3101
Jwink3101 / finddupes.py
Last active November 20, 2020 02:19
Really barebones duplicate file finder. Doesn't even have a CLI
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Duplicate file finder. Finds dupe files by comparing the following attributes.
Matching size is nessesary but very, very far from sufficient. Still, it is very
fast so we use that to cut out a lot of files.
* size
* Obviously not at all robust but a nessesary
* CRC checksum
@tg12
tg12 / ftp_check.py
Last active August 27, 2019 19:51
Fast Multi-threaded FTP Scanner
from datetime import datetime
import time
import threading
###########################
from multiprocessing import Process
import random
###########################
import dns.resolver
import dns.reversename
import ftplib
@santiagobasulto
santiagobasulto / README.md
Last active May 16, 2021 10:13
Download HumbleBundle books in batch with a simple Python script.

Download HumbleBundle books

This is a quick Python script I wrote to download HumbleBundle books in batch. I bought the amazing Machine Learning by O'Reilly bundle. There were 15 books to download, with 3 different file formats per book. So I scratched a quick script to download all of them in batch.

(Final Result: books downloaded)

import os
import json
import pandas as pd
def main():
print("Summary omercy!")
lst = []
for root, dirs, files in os.walk('.', topdown=False):
for name in files:
@lorey
lorey / markdown_to_text.py
Last active April 8, 2024 03:25
Markdown to Plaintext in Python
from bs4 import BeautifulSoup
from markdown import markdown
import re
def markdown_to_text(markdown_string):
""" Converts a markdown string to plaintext """
# md -> html -> text since BeautifulSoup can extract text cleanly
html = markdown(markdown_string)
@magnetikonline
magnetikonline / README.md
Last active February 4, 2024 07:45
List all Git repository objects by size.

List all Git repository objects by size

Summary

Bash script to:

  • Iterate all commits made within a Git repository.
@graymouser
graymouser / hb_all_books_dl.js
Created February 28, 2016 14:09
Humble bundle book bundles - download all books at once
/*
After purchasing a humble book bundle, go to your download page for that bundle.
Open a console window for the page and paste in the below javascript
*/
$('a').each(function(i){
if ($.trim($(this).text()) == 'MOBI') {
$('body').append('<iframe id="dl_iframe_'+i+'" style="display:none;">');
document.getElementById('dl_iframe_'+i).src = $(this).data('web');
}
});