Skip to content

Instantly share code, notes, and snippets.

View AlexGascon's full-sized avatar

Alex Gascón AlexGascon

View GitHub Profile

curl exercises

In this gist I'll upload the solutions to the 21 curl exercises proposed by Julia Evans on this blogpost. While curl definitely isn't a life-changing skill, it's a tool that can be really useful once you master it, and considering the low investment that is required it's definitely a good time investment

All the solutions contain the command that needs to be run to solve the exercise; apart from that, some of them will include also the response that we've obtained, or a small explanation about the different arguments of the command that we've used. That will make it easier for people reading this to get a better understanding of the solution.

Exercise 1

Request https://httpbin.org

Command: curl https://httpbin.org

@AlexGascon
AlexGascon / unrarer.py
Last active June 20, 2020 16:37
Python script to uncompress all the rar files in the current directory and delete the compressed .rar afterwards. It uses several system subprocesses in parallel to speed-up the process. Also valid if the files are protected with a password. Requires the rarfile (https://pypi.org/project/rarfile/) package
import glob
import multiprocessing
import os
import rarfile
NUM_PROCESSES = 5
PASSWORD = None # Set to a string if the rar files are protected with a password
def log(msg):
@AlexGascon
AlexGascon / splitter.py
Created May 12, 2024 17:42
Python script to split an audio file into 29-minute fragments
import datetime
import json
import shlex
import subprocess
import sys
FFMPEG_COMMAND = 'ffmpeg -i "{cap_name}" -ss {start_time} -t 00:29:00 -acodec copy "{cap_name}_part_{number}.{extension}"'
DESIRED_AUDIO_FRAGMENT_LENGTH_SECONDS = 29 * 60 # 29 minutes