Skip to content

Instantly share code, notes, and snippets.

@edorian
edorian / download.js
Created June 3, 2024 11:36
GitHub container registry download numbers
// Extract data for the "last 30 day downloads" svg
svg = document.querySelector('#repo-content-turbo-frame > div > div > div > div.d-flex.flex-column.flex-md-row.mt-n1.mt-2.gutter-condensed.gutter-lg.flex-column > div.col-12.col-md-3.flex-shrink-0 > div:nth-child(3) > div.container-lg.my-3.d-flex.clearfix > div.lh-condensed.d-inline-flex.flex-column.flex-items-baseline.tooltipped.tooltipped-s.mt-3 > svg');
rows = [];
svg.childNodes.forEach((element) => {
if(element.tagName === 'rect') {
rows.push([element.getAttribute('data-date'), element.getAttribute('data-merge-count')]);
}
});
@edorian
edorian / blog.md
Last active February 10, 2023 13:43
PHP Prozess hanging in curl when using Guzzle or Symfony HttpClient

PHP Prozess hanging in curl when using Guzzle or Symfony HttpClient

A couple of month ago we ran into an issue with hanging PHP processes during/after HTTP calls.

Today another friend of mine ran into that issue, so here some notes in the hopes that this might be helpful to someone :)

Diagnose

strace the hanging process and see if it hangs in rt_sigaction

Reading symbols from /usr/sbin/apache2...Reading symbols from /usr/lib/debug/.build-id/e7/c779eae1fb3fd9eaed94cc75d596e785bc121f.debug...done.
done.
[New LWP 7136]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `/usr/sbin/apache2 -k start'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x00007f00c236f000 in _emalloc () from /usr/lib/apache2/modules/libphp7.2.so
(gdb) bt
#0 0x00007f00c236f000 in _emalloc () from /usr/lib/apache2/modules/libphp7.2.so
@edorian
edorian / fizzBuzzGen.php
Created June 28, 2018 18:08
step() feels very inelegant
<?php
$fizz = function() {
while(true) {
yield '';
yield '';
yield 'Fizz';
}
};
@edorian
edorian / BaseTest.php
Created May 22, 2018 16:18
PHPCS integration testing
<?php
use PHPUnit\Framework\TestCase;
abstract class BaseTest extends TestCase {
public function testSniff() {
$sniff = substr(get_class($this), 0, -4);
$output = [];
$phpcs = __DIR__ . '/../../vendor/bin/phpcs';
@edorian
edorian / gist:0e07040724899a10b807
Last active November 6, 2015 11:03
Stacked area charts in graphite
https://graphite.rgcloud.net/render/?from=-1month
&yMin=0
&areaAlpha=0.1
&areaMode=all
&width=1400
&height=800
&colorList=green,darkgreen,gray,yellow,red,blue
&title=Title
&vtitle=[%] of thing
&target=alias(
#0 _zend_mm_free_int (heap=0x129b300, p=0x318bb78) at /build/buildd/php5-5.5.7+dfsg/Zend/zend_alloc.c:2104
#1 0x000000000075445a in _zval_dtor (zvalue=0x318bb88) at /build/buildd/php5-5.5.7+dfsg/Zend/zend_variables.h:35
#2 i_zval_ptr_dtor (zval_ptr=0x318bb88) at /build/buildd/php5-5.5.7+dfsg/Zend/zend_execute.h:81
#3 ZEND_ASSIGN_SPEC_VAR_VAR_HANDLER (execute_data=0x7ffd8f6e81e0) at /build/buildd/php5-5.5.7+dfsg/Zend/zend_vm_execute.h:19950
#4 0x000000000074e808 in execute_ex (execute_data=0x7ffd8f6e81e0) at /build/buildd/php5-5.5.7+dfsg/Zend/zend_vm_execute.h:363
#5 0x00000000006cfb16 in dtrace_execute_ex (execute_data=0x7ffd8f6e81e0) at /build/buildd/php5-5.5.7+dfsg/Zend/zend_dtrace.c:73
#6 0x000000000078a777 in zend_do_fcall_common_helper_SPEC (execute_data=0x7ffd8f6e8058) at /build/buildd/php5-5.5.7+dfsg/Zend/zend_vm_execute.h:584
#7 0x000000000074e808 in execute_ex (execute_data=0x7ffd8f6e8058) at /build/buildd/php5-5.5.7+dfsg/Zend/zend_vm_execute.h:363
#8 0x00000000006cfb16 in dtrace_execute_ex
@edorian
edorian / gist:8005781
Last active December 31, 2015 15:19
Disallow certain annotations in doc blocks
<?php
class RgStandard_Sniffs_Rg_DisallowAnnotationSniff implements PHP_CodeSniffer_Sniff {
private $disallowedAnnotations = [
'@abstract' => 'Please use the language construct instead.'
];
public function register() {
return [T_DOC_COMMENT];
"type": "git",
"url": "https://github.com/Seldaek/monolog.git",
- "reference": "583618d5cd2115a52101694aca87afb182b3e567"
+ "reference": "1.5.0"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/Seldaek/monolog/zipball/583618d5cd2115a52101694aca87afb182b3e567",
- "reference": "583618d5cd2115a52101694aca87afb182b3e567",
+ "url": "https://api.github.com/repos/Seldaek/monolog/zipball/1.5.0",
edo@localhost ~/auto-all-the-loads $ tree && find . -type f -print -exec cat {} \;
.
|-- autoload.php
|-- index.php
`-- src
|-- A.php
`-- bar
|-- baz
| `-- B.php
`-- B.php