Skip to content

Instantly share code, notes, and snippets.

View sb15's full-sized avatar

Alexander Perov sb15

View GitHub Profile
@avoine
avoine / gist:2912777
Created June 11, 2012 21:19
Bridge to send rsyslog logs to sentry (http://www.getsentry.com)
#!/usr/bin/env python
#
# Copyright 2012 Patrick Hetu <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
@troy
troy / send_remote_syslog.php
Last active March 30, 2025 16:15
Send UDP remote syslog message from PHP (RFC 3164)
# replace PAPERTRAIL_HOSTNAME and PAPERTRAIL_PORT
# see http://help.papertrailapp.com/ for additional PHP syslog options
function send_remote_syslog($message, $component = "web", $program = "next_big_thing") {
$sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
foreach(explode("\n", $message) as $line) {
$syslog_message = "<22>" . date('M d H:i:s ') . $program . ' ' . $component . ': ' . $line;
socket_sendto($sock, $syslog_message, strlen($syslog_message), 0, PAPERTRAIL_HOSTNAME, PAPERTRAIL_PORT);
}
socket_close($sock);
@Ocramius
Ocramius / module.config.php
Created November 12, 2011 13:42
Zend\Db adapter instantiation through Zend Framework 2 Di
<?php
return array(
'di' => array(
'definition' => array(
//teaching DI to use the factory
'class' => array(
'Zend\Db\Db' => array(
'methods' => array(
'factory' => array(
'adapter' => array(
@balupton
balupton / README.md
Last active February 10, 2025 05:38
Ajaxify a Website with the HTML5 History API using History.js, jQuery and ScrollTo
#!/bin/bash
# SPDX-License-Identifier: MIT
## Copyright (C) 2009 Przemyslaw Pawelczyk <[email protected]>
##
## This script is licensed under the terms of the MIT license.
## https://opensource.org/licenses/MIT
#
# Lockable script boilerplate
@ischenkodv
ischenkodv / endless.js
Created April 18, 2009 21:35
Script for endless scrolling using jQuery
// script for endless scrolling using jQuery
// demo: http://www.jstoolbox.com/demo/endless/
var engine = {
posts : [],
target : null,
busy : false,
count : 5,
render : function(obj){