Skip to content

Instantly share code, notes, and snippets.

View meyerbaptiste's full-sized avatar
🇨🇭
Yodelling

Baptiste Meyer meyerbaptiste

🇨🇭
Yodelling
View GitHub Profile
@bwoebi
bwoebi / text.md
Last active February 19, 2022 01:08
fread() on non-blocking sockets

Reading of non-blocking TCP sockets in PHP

As a short heads-up for those unfamiliar:

  • There is a PHP level buffer. Whenever more is actually read from the socket (default chunk size is 8192), than the user requests in his PHP code, the data is stored there.
  • There is an OS level buffer. There all incoming network data lands. The event loop only knows of that one and checks that one for being non-empty.

Trivial single read

The trivial reading function in PHP is fread($socket, $maxSize).

@tzmartin
tzmartin / m3u8-to-mp4.md
Last active May 29, 2024 22:42
m3u8 stream to mp4 using ffmpeg

1. Copy m3u8 link

Alt text

2. Run command

echo "Enter m3u8 link:";read link;echo "Enter output filename:";read filename;ffmpeg -i "$link" -bsf:a aac_adtstoasc -vcodec copy -c copy -crf 50 $filename.mp4
@pavelbinar
pavelbinar / extract-subtitles-from-mkv.md
Last active December 24, 2023 12:10 — forked from bmaeser/subtitle-extract.txt
Extract subtitles from .mkv files on Mac OS X
@boboldehampsink
boboldehampsink / ios_disable_push_notifications.js
Created March 17, 2015 15:11
Cordova - after_platform_add hook to disable push notifications code
#!/usr/bin/env node
var GCC_PREPROCESSOR_DEFINITIONS = '"$(inherited) DISABLE_PUSH_NOTIFICATIONS=1"';
var fs = require("fs");
var path = require("path");
var xcode = require('xcode');
var projectRoot = process.argv[2];
function getProjectName(protoPath) {
@fomightez
fomightez / remove blank lines regex.md
Last active February 22, 2024 09:49
remove all blank lines using regular expressions
@magnetikonline
magnetikonline / README.md
Last active April 30, 2024 00:45
Setting Nginx FastCGI response buffer sizes.
@rejsmont
rejsmont / AclFilter.php
Last active February 14, 2019 08:10
ACL filter for Doctrine QueryBuilder and Query. Supports multiple filters applied to a single query, entity inheritance and role hierarchies.
<?php
/*
* Copyright 2013 Radoslaw Kamil Ejsmont <radoslaw@ejsmont.net>
*
* Original code by mailaneel is available at
* https://gist.github.com/mailaneel/1363377
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ziadoz
ziadoz / halt_compiler.php
Last active April 23, 2024 17:55
Using PHP Halt Compiler
<?php
/**
* The __halt_compiler() function will stop the PHP compiler when called.
* You can then use the __COMPILER_HALT_OFFSET__ constant to grab the contents of the PHP file after the halt.
* In this example a PHP template is stored after the halt, to allow simple separation of logic from templating.
* The template is stored in a temporary file so it can be included and parsed.
*
* See: https://github.com/bobthecow/mustache.php/blob/dev/src/Mustache/Loader/InlineLoader.php
* http://php.net/manual/en/function.halt-compiler.php
*/