Skip to content

Instantly share code, notes, and snippets.

@protrolium
protrolium / ffmpeg.md
Last active May 3, 2024 18:58
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:

@SKempin
SKempin / Git Subtree basics.md
Last active May 3, 2024 02:57
Git Subtree basics

Git Subtree Basics

If you hate git submodule, then you may want to give git subtree a try.

Background

When you want to use a subtree, you add the subtree to an existing repository where the subtree is a reference to another repository url and branch/tag. This add command adds all the code and files into the main repository locally; it's not just a reference to a remote repo.

When you stage and commit files for the main repo, it will add all of the remote files in the same operation. The subtree checkout will pull all the files in one pass, so there is no need to try and connect to another repo to get the portion of subtree files, because they were already included in the main repo.

Adding a subtree

Let's say you already have a git repository with at least one commit. You can add another repository into this respository like this:

@GLMeece
GLMeece / latency_numbers.md
Last active April 29, 2024 09:47
Latency Numbers Every Programmer Should Know - MarkDown Fork

Latency Comparison Numbers

Note: "Forked" from Latency Numbers Every Programmer Should Know

Event Nanoseconds Microseconds Milliseconds Comparison
L1 cache reference 0.5 - - -
Branch mispredict 5.0 - - -
L2 cache reference 7.0 - - 14x L1 cache
Mutex lock/unlock 25.0 - - -
@nikic
nikic / objects_arrays.md
Last active April 12, 2024 17:05
Post explaining why objects often use less memory than arrays (in PHP)

Why objects (usually) use less memory than arrays in PHP

This is just a small post in response to [this tweet][tweet] by Julien Pauli (who by the way is the release manager for PHP 5.5). In the tweet he claims that objects use more memory than arrays in PHP. Even though it can be like that, it's not true in most cases. (Note: This only applies to PHP 5.4 or newer.)

The reason why it's easy to assume that objects are larger than arrays is because objects can be seen as an array of properties and a bit of additional information (like the class it belongs to). And as array + additional info > array it obviously follows that objects are larger. The thing is that in most cases PHP can optimize the array part of it away. So how does that work?

The key here is that objects usually have a predefined set of keys, whereas arrays don't:

@p3t3r67x0
p3t3r67x0 / openssl_commands.md
Last active February 3, 2024 18:53
Some list of openssl commands for check and verify your keys

openssl

Install

Install the OpenSSL on Debian based systems

sudo apt-get install openssl
#!/usr/bin/env python
"""
ignore_moves.py v0.2
Filter relocated lines from a unified diff format stream.
Offered under the terms of the MIT License at github.com
Taken from http://stackoverflow.com/questions/1380333/
"""
import sys
from optparse import OptionParser
@helhum
helhum / install.sh
Last active January 10, 2023 15:38
Unattended TYPO3 7LTS installation (including introduction package)
composer create-project typo3/cms-base-distribution='^7.6.0' my-test-typo3 --no-interaction
cd my-test-typo3/
composer require helhum/typo3-console
# This will only work with PHP < 7 as realurl need PHP 5.x
composer require typo3-ter/introduction
cp web/typo3conf/ext/typo3_console/Scripts/typo3cms .
cp web/typo3conf/ext/bootstrap_package/Configuration/Apache/.htaccess web/
chmod +x typo3cms
./typo3cms install:setup --non-interactive --database-user-name="root" --database-user-password="root" --database-host-name="localhost" --database-port="3306" --database-name="t3_my_test" --admin-user-name="admin" --admin-password="password" --site-name="Auto Install"
./typo3cms database:updateschema '*.*'
@fsuter
fsuter / gist:5803411
Last active November 22, 2022 10:18
The code samples below demonstrate how to register a custom soft reference parser for TYPO3 CMS. This consists of 3 steps: 1) register the soft reference parser key globally 2) add the soft reference parser key to the appropriate fields in the TCA 3) code the soft reference parser The example is taken from extension "templatedisplay".
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['softRefParser'][$_EXTKEY] = 'Tesseract\Templatedisplay\Service\SoftReferenceParser';
@stmllr
stmllr / RemoveUnreferencedFilesMarkedAsMissing.php
Created October 24, 2016 10:52
TYPO3 scheduler task to delete rows from sys_file without 1) a corresponding file and 2) a reference in sys_file_reference
<?php
namespace My\Ext\Scheduler\Task;
/**
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
@albarralnunez
albarralnunez / main.tex
Last active June 3, 2022 10:43
LaTeX - Template for presentation
% Copyright 2004 by Till Tantau <tantau@users.sourceforge.net>.
%
% In principle, this file can be redistributed and/or modified under
% the terms of the GNU Public License, version 2.
%
% However, this file is supposed to be a template to be modified
% for your own needs. For this reason, if you use this file as a
% template and not specifically distribute it as part of a another
% package/program, I grant the extra permission to freely copy and
% modify this file as you see fit and even to delete this copyright