Skip to content

Instantly share code, notes, and snippets.

@protrolium
protrolium / ffmpeg.md
Last active May 2, 2024 12:02
ffmpeg guide

ffmpeg

Converting Audio into Different Formats / Sample Rates

Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma

You can get the list of supported formats with:
ffmpeg -formats

You can get the list of installed codecs with:

@ott3rly
ott3rly / nmap-xml-to-httpx.sh
Created February 20, 2024 09:50
Convert nmap xml output suitable for httpx
#!/bin/bash
# Check if an argument was provided
if [ $# -eq 0 ]; then
NMAP_XML_OUTPUT="/dev/stdin"
else
NMAP_XML_OUTPUT="$1"
fi
# Use xmllint to parse IP addresses and ports from the Nmap XML output
@jadia
jadia / malloc_calloc_memset.md
Created October 19, 2018 13:30
How Malloc+memset and calloc works

The short version:

Always use calloc() instead of malloc()+memset(). In most cases, they will be the same. In some cases, calloc() will do less work because it can skip memset() entirely. In other cases, calloc() can even cheat and not allocate any memory! However, malloc()+memset() will always do the full amount of work.

Understanding this requires a short tour of the memory system.

Quick tour of memory

There are four main parts here: your program, the standard library, the kernel, and the page tables. You already know your program, so...

Memory allocators like malloc() and calloc() are mostly there to take small allocations (anything from 1 byte to 100s of KB) and group them into larger pools of memory. For example, if you allocate 16 bytes, malloc() will first try to get 16 bytes out of one of its pools, and then ask for more memory from the kernel when the pool runs dry. However, since the program you're asking about is allocating for a large amount of memory at once, `mal

@davialexandre
davialexandre / gruvbox_dark.json
Created June 23, 2019 18:09
Gruvbox Dark color scheme for the new Windows Terminal
{
"background" : "#282828",
"black" : "#282828",
"blue" : "#458588",
"brightBlack" : "#928374",
"brightBlue" : "#83A598",
"brightCyan" : "#8EC07C",
"brightGreen" : "#B8BB26",
"brightPurple" : "#D3869B",
"brightRed" : "#FB4934",
@careyi3
careyi3 / README.md
Last active May 2, 2024 11:59
Arduino PID Implementation

Arduino PID

This is a basic implementation of a PID controller on an Arduino.

system_diagram

To replicate this, wire up the system as shown below:

system_diagram

@muhdiboy
muhdiboy / lastfm-automated-remove-duplicates.md
Last active May 2, 2024 11:59
LastFM automated duplicate scrobble deletion script

Why would I need this?

Your scrobbler might have decided to scrobble every song hundreds of times, and you can't really remove those scrobbles efficiently. Or you might have accidentally installed multiple scrobbler extensions at the same time - wondering why multiple scrobbles appear for every song played at a time - and you want to clear them after finding the issue.

Using this script still doesn't necessarily make the process quick since Last.fm only displays a limited number of scrobbles that can be removed on each page of your library. However unlike the implementation of @sk22 and its forks, this UserScript, which is derived from those scripts, is run once. The rest of the process is automated and the script will stop at the page you have set using the prompt.

Installation

Prerequisites

@goll
goll / README.md
Last active May 2, 2024 11:59
Docker nftables configuration for Debian 10
@pierrejoubert73
pierrejoubert73 / markdown-details-collapsible.md
Last active May 2, 2024 11:58
How to add a collapsible section in markdown.

How to add a collapsible section in markdown

1. Example

Click me

Heading

  1. Foo
  2. Bar
    • Baz
  • Qux
{-# language ApplicativeDo #-}
{-# language LambdaCase #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE TypeInType #-}
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE InstanceSigs #-}
-- not sure if this is all extensions or all these extensions are needed, just pasting from the file
module VerifySchema where
@s-leon
s-leon / up
Last active May 2, 2024 11:56
oS TW update script
#!/bin/bash
sudo -s <<EOF
zypper dup -l -y --no-recommends --allow-downgrade --allow-arch-change --force-resolution
flatpak update -y --noninteractive --force-remove
flatpak remove --unused --delete-data -y
#flatpak repair
journalctl --rotate
journalctl --vacuum-time=2d
zypper clean
rm -rfv /var/tmp/flatpak-cache-*