Skip to content

Instantly share code, notes, and snippets.

@glensc
glensc / message_json_parser.py
Last active June 27, 2021 12:18 — forked from multun/message_json_parser.py
Pretty-print a facebook message.json, fixing up broken encoding
#!/usr/bin/env python3
import sys
import json
import warnings
from datetime import datetime
def fixup_str(text):
return text.encode('latin1').decode('utf8')
@glensc
glensc / .gitignore
Last active March 11, 2021 22:03
RFC: Reproducible vendor directory contents #9768
/vendor/
@glensc
glensc / README.md
Last active October 11, 2018 16:31
Create Docker image tag using Registry v2 API
@glensc
glensc / .gitignore
Last active August 23, 2022 11:57
brew and phpXY in PATH
*~
/php??
@glensc
glensc / .gitignore
Last active July 24, 2017 06:25
fedmsg and reactor.callLater issue
*~
*.py[co]
/*.egg-info/
@glensc
glensc / README.md
Last active May 17, 2017 09:40
PHPStorm Launch Wrapper

PHPStorm Launch Wrapper

Wrapper that allows to open projects from commandline:

$ phpstorm ~/projects/awesome-project

Download this snippet and install into your $PATH

@glensc
glensc / .gitignore
Last active May 12, 2017 08:39
PEAR repository type does not process PEAR installer dependency #6413
/composer.lock
/vendor/
@glensc
glensc / pre-commit
Last active May 13, 2017 08:58
php-cs-fixer git pre commit hook
#!/bin/sh
# A git pre-commit hook to run php-cs-fixer on all changed php files.
#
# Inspired from https://gist.github.com/jwage/b1614c96ea22ccaf68b7
#
# Author: Elan Ruusamäe <[email protected]>
# Date: 2017-05-03
# URL: https://gist.github.com/glensc/cf03265205b67f3735b6fb19ccd4ab2a
set -e
@glensc
glensc / index.php
Created April 20, 2016 17:59
GitHub Push Hook PHP Handler
<?php
// https://developer.github.com/webhooks/
// ruby -rsecurerandom -e 'puts SecureRandom.hex(20)'
define('HOOK_SECRET', '');
set_exception_handler(function($e) {
header('HTTP/1.1 500 Internal Server Error');
error_log(basename(__FILE__, '.php') . ': '. $e->getMessage());
die("Error on line {$e->getLine()}: " . htmlspecialchars($e->getMessage()));
@glensc
glensc / slack-svn-hook.py
Last active January 31, 2017 14:35
Subversion integration with Slack
#!/usr/bin/python
# Script for Subversion integration with Slack
#
# Uses slackweb module:
# https://github.com/satoshi03/slack-python-webhook
# 1. Save this file in /usr/bin as slack-svn-hook
# 2. Make it executable:
# chmod +x /usr/bin/slack-svn-hook
# 3. Put this line at the end of file of your_svn_repo/hooks/post-commit: