Skip to content

Instantly share code, notes, and snippets.

"""Quick and dirty HLS transport stream downloader.
Give it a URI that points to a media playlist (one that contains transport stream URIs,
not a multivariant playlist that contains other playlist URIs).
It will read the playlist, download all the segments, and write them to your chosen
output location.
A single output file is created. This works because MPEG Transport Stream files
can be concatenated.
"""
from argparse import ArgumentParser
from concurrent.futures import ThreadPoolExecutor
@darwing1210
darwing1210 / async_download_files.py
Last active July 14, 2025 19:23
Script to download files in a async way, using Python asyncio
import os
import asyncio
import aiohttp # pip install aiohttp
import aiofile # pip install aiofile
REPORTS_FOLDER = "reports"
FILES_PATH = os.path.join(REPORTS_FOLDER, "files")
def download_files_from_report(urls):
@greenstick
greenstick / print-progress-auto.py
Last active June 27, 2024 20:04
Python: printProgressBar function with autoresize option
# This version of the printProgressBar function implements an optional autoresize argument.
# It has been updated from a previous version to use the shutil Python module to determine
# the terminal size. This update should allow it to work on most operating systems and does
# speed up the autosize feature quite a bit – though it still slows things down quite a bit.
# For more robust features, it's recommended you use a progress bar library like tdqm (see: https://github.com/tqdm/tqdm)
def printProgressBar (iteration, total, prefix = '', suffix = '', decimals = 1, length = 100, fill = '█', autosize = False):
"""
Call in a loop to create terminal progress bar
@params:
@Kizjkre
Kizjkre / symbolab.js
Last active May 18, 2024 17:59
Symbolab Unlocker
// ==UserScript==
// @name Symbolab Unlocker
// @version 1.0
// @description Unlocks locked steps, hides upgrade tooltips, and enables answer verification
// @author TheAmazingness
// @match https://www.symbolab.com/solver/*
// @include https://code.jquery.com/jquery-3.3.1.min.js
// @grant none
// ==/UserScript==
@dnaismyth
dnaismyth / ViewController.swift
Created October 22, 2017 17:33
DZNEmptyDataSet Example
import UIKit
import DZNEmptyDataSet
class ViewController: UIViewController, DZNEmptyDataSetSource, DZNEmptyDataSetDelegate {
@IBOutlet var tableView: UITableView!
let tungsten: UIColor = UIColor(red:0.20, green:0.20, blue:0.20, alpha:1.0)
override func viewDidLoad() {
@kevinadi
kevinadi / mongodb-ssl.sh
Last active March 24, 2025 10:32
Script to create self-signed CA certificates, server certificates, and client certificates for testing MongoDB with SSL
#!/bin/sh
# Generate self signed root CA cert
openssl req -nodes -x509 -newkey rsa:2048 -keyout ca.key -out ca.crt -subj "/C=AU/ST=NSW/L=Sydney/O=MongoDB/OU=root/CN=`hostname -f`/[email protected]"
# Generate server cert to be signed
openssl req -nodes -newkey rsa:2048 -keyout server.key -out server.csr -subj "/C=AU/ST=NSW/L=Sydney/O=MongoDB/OU=server/CN=`hostname -f`/[email protected]"
# Sign the server cert
@rkuzsma
rkuzsma / docker-bash-completion.md
Last active June 13, 2025 09:59
How to configure Bash Completion on Mac for Docker and Docker-Compose

How to configure Bash Completion on Mac for Docker and Docker-Compose

Copied from the official Docker-for-mac documentation (thanks Brett for the updated doc pointer):

Install shell completion

Docker Desktop for Mac comes with scripts to enable completion for the docker, docker-machine, and docker-compose commands. The completion scripts may be found inside Docker.app, in the Contents/Resources/etc/ directory and can be installed both in Bash and Zsh.

Bash

Bash has built-in support for completion To activate completion for Docker commands, these files need to be copied or symlinked to your bash_completion.d/ directory. For example, if you installed bash via Homebrew:

@bsweger
bsweger / useful_pandas_snippets.md
Last active June 14, 2025 19:01
Useful Pandas Snippets

Useful Pandas Snippets

A personal diary of DataFrame munging over the years.

Data Types and Conversion

Convert Series datatype to numeric (will error if column has non-numeric values)
(h/t @makmanalp)

@nathando
nathando / authenticated_api
Created July 9, 2014 10:21
Authenticated API
@frappe.whitelist(allow_guest=True)
@post_only
def login_test():
try:
frappe.local.login_manager.login()
full_name = frappe.response.pop("full_name")
# Return encrypted token
session_token = AESencrypt('password', str(frappe.local.session.get('sid')))
frappe.local.cookie_manager.set_cookie("sid", "")
return {"status": 1, "full_name": full_name, "s_token": session_token }