Skip to content

Instantly share code, notes, and snippets.

🌖
It's happening

Alex Rock Pierstoval

🌖
It's happening
Block or report user

Report or block Pierstoval

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Nyholm
Nyholm / gist:317df136ded2087649d0c9c464285cb1
Last active Apr 2, 2018
Show who contributed to your vendors folder
View gist:317df136ded2087649d0c9c464285cb1
# Install git fame
gem install git_fame
# Install all vendors with source
rm -rf vendor/*
composer update --prefer-source
# Do the calculations. This might take 30 minutes to complete.
rm output.txt
find ./vendor -type d -depth 2 ! -path "./vendor/composer" -exec echo {} \; -exec git fame --sort=loc --hide-progressbar --repository={} \; >> output.txt
@hikari-no-yume
hikari-no-yume / example.php
Created Mar 20, 2017
function chaining for PHP 7
View example.php
<?php declare(strict_types=1);
require_once "✨.🐘";
✨($_)->strlen("foo")->var_dump($_);
View barcode.php
<?php
<<<CONFIG
packages:
- "zendframework/zend-barcode: ^2.5"
- "symfony/console: ^2.7"
CONFIG;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Helper\QuestionHelper;
@Pierstoval
Pierstoval / imagemagick_geometry.php
Last active Aug 1, 2018
This enormous regexp matches any "Geometry" parameter for ImageMagick. See the docs about this: http://www.imagemagick.org/script/command-line-processing.php#geometry
View imagemagick_geometry.php
<?php
$number = "\d*(?:\.\d+)?"; // It's a reference to use in other cases that matches any kind of number/float
$width = "(?<w>(?:$number)?%?)?"; // This is the first part, the width
$height = "(?:x(?<h>(?:$number)?%?))?"; // Here is the height, the same as "width" but starting with an "x"
$aspect = "[!><@^]"; // These are the different filters one can use to stretch, shrink, etc.
$size = "$width$height"; // To match any size we need width and height at least (aspect comes later)
@ImJasonH
ImJasonH / markdown.css
Last active Oct 19, 2019
Render Markdown as unrendered Markdown (see http://jsbin.com/huwosomawo)
View markdown.css
* {
font-size: 12pt;
font-family: monospace;
font-weight: normal;
font-style: normal;
text-decoration: none;
color: black;
cursor: default;
}
@maximecolin
maximecolin / ConsoleListener.php
Last active Apr 30, 2019
Symfony2 : Configuring the Request Context for CLI Command
View ConsoleListener.php
<?php
namespace Acme\DemoBundle\EventListener;
use Symfony\Component\Routing\RouterInterface;
class ConsoleListener
{
/**
* @var RouterInterface
@porjo
porjo / timelapse.md
Last active Aug 3, 2019
ffmpeg time-lapse
View timelapse.md

Convert sequence of JPEG images to MP4 video

Simple glob:

ffmpeg -r 24 -i '*.JPG' -s hd1080 -vcodec libx264 timelapse.mp4

Start from DSC_0079.JPG

ffmpeg -r 24 -f image2 -start_number 79 -i DSC_%04d.JPG -s hd1080 -vcodec libx264 timelapse2.mp4
@lyrixx
lyrixx / segfault-finder.php
Last active Sep 23, 2019
How to find a segfault in PHP
View segfault-finder.php
<?php
register_tick_function(function() {
$bt = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1);
$last = reset($bt);
$info = sprintf("%s +%d\n", $last['file'], $last['line']);
file_put_contents('/tmp/segfault.txt', $info, FILE_APPEND);
// or
// file_put_contents('php://output', $info, FILE_APPEND);
});
You can’t perform that action at this time.