Skip to content

Instantly share code, notes, and snippets.

View nickkraakman's full-sized avatar

Nick nickkraakman

View GitHub Profile
@nickkraakman
nickkraakman / ffmpeg-cheatsheet.md
Last active April 23, 2024 20:53
FFmpeg cheat sheet for 360 video

FFmpeg Cheat Sheet for 360º video

Brought to you by Headjack

 
FFmpeg is one of the most powerful tools for video transcoding and manipulation, but it's fairly complex and confusing to use. That's why I decided to create this cheat sheet which shows some of the most often used commands.

 
Let's start with some basics:

  • ffmpeg calls the FFmpeg application in the command line window, could also be the full path to the FFmpeg binary or .exe file
@nickkraakman
nickkraakman / functions.php
Last active November 17, 2023 05:14
Subscribe to- or remove users from MailPoet lists using the MailPoet API
// Subscribe to or remove from MailPoet
// Add this at the bottom of your WordPress theme's functions.php file
// POST to https://headjack.io/wp-admin/admin-post.php?action=subscribe_to_mailpoet
function subscribe_to_mailpoet() {
$api_key = "XXXXXXXXXX"; // Basic API key authentication, send over SSL
if ( !empty($_POST['key']) && $_POST['key'] == $api_key ) {
$subscriber_data = array(
@nickkraakman
nickkraakman / exponential-backoff.php
Last active June 8, 2023 19:52
API call with max number of retries and exponential backoff in PHP
<?php
$retries = 0; // Init the retries variable
$maxRetries = 5; // Means we try max 6 times
$retry = false; // Should we retry or not?
$initialWait = 1.0; // Initial wait time in seconds
try {
do {
// If it is not the first try, calculate exponential backoff and wait
@nickkraakman
nickkraakman / filter_outliers_chauvenet.py
Created April 5, 2022 15:31
A Python function that uses Chauvenet's Criterion to filter outliers from a dataset and returns only the reasonable values.
import numpy
from scipy.special import erfc
def filter_outliers(datapoints):
"""Run Chauvenet's Criterion to remove outliers
@See: https://www.statisticshowto.com/chauvenets-criterion/
@See: https://github.com/msproteomicstools/msproteomicstools/blob/master/msproteomicstoolslib/math/chauvenet.py
Args:
datapoints (list): Array of datapoints from which to filter the outliers
@nickkraakman
nickkraakman / iEDGAR
Created November 12, 2014 11:15
Get XML response of SEC EDGAR filing URLs using the iEDGAR API
<?php
function getURLs($ticker){
$content = file_get_content("https://www.valuespreadsheet.com/iedgar/results.php?stock=".$ticker."&output=xml");
$xml = simplexml_load_string($content);
echo "<pre>"; print_r($xml); echo "</pre>";
}