Skip to content

Instantly share code, notes, and snippets.

View nilyang's full-sized avatar
💭
I may be slow to respond.

nilyang

💭
I may be slow to respond.
  • Chongqing China
View GitHub Profile
@nilyang
nilyang / ping.gs.php
Created August 24, 2023 09:52 — forked from cereal-s/ping.gs.php
Get number of pages from a PDF, using GhostScript.
<?php
/**
* Return the number of pages of a PDF.
*
* Imagick::pingImage() takes too much when dealing with big files.
*
* Command to execute:
*
* gs -q -dNODISPLAY -c "(%s) (r) file runpdfbegin pdfpagecount = quit"
@nilyang
nilyang / pre-push
Created July 12, 2022 17:54 — forked from taufek/pre-push
PrePush Git Hook with PhpCs and PhpStan
#!/bin/sh
#
# An example hook script to verify what is about to be committed.
# Called by "git commit" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
#
# To enable this hook, rename this file to "pre-commit".
exec < /dev/tty