Skip to content

Instantly share code, notes, and snippets.

View leite's full-sized avatar
🚩

Francisco Leite leite

🚩
View GitHub Profile
@leite
leite / bla.php
Created December 2, 2015 15:37
wtf!
# log / debug
$filename = $this->api_json . 'debug.txt';
$fp = fopen($filename, 'w');
fwrite($fp, "\n\n------- スタート " . $debug['date_start'] . " ----------\n\n");
//fwrite($fp, print_r($result, true));
fwrite($fp, "\n\n------- 終わり " . $debug['date_end'] . " ----------\n\n");
fclose($fp);
echo "end\n";
@leite
leite / php.mkd
Last active November 3, 2023 23:35
how to php 5.4.45 (old stable)

ubuntu 14.04 LTS

~ docker run -d -ti --name=xenophon ubuntu:14.04 /bin/bash
~ docker attach xenophon

update && install build essentials plus libraries

root@bdb791349df9:~# sudo apt-get update
@leite
leite / (gdb) bt
Created November 27, 2015 18:49
gdb /usr/sbin/php5-fpm /tmp/core-php5-fpm.105
#0 0x0000000000606423 in php_array_data_compare (a=<optimized out>, b=<optimized out>) at /build/php5-pO28mL/php5-5.5.9+dfsg/ext/standard/array.c:373
#1 0x000000000070355c in zend_qsort_r (base=<optimized out>, nmemb=<optimized out>, siz=siz@entry=8, compare=compare@entry=0x606400 <php_array_data_compare>, arg=arg@entry=0x0)
at /build/php5-pO28mL/php5-5.5.9+dfsg/Zend/zend_qsort.c:87
#2 0x00000000007036a8 in zend_qsort (base=<optimized out>, nmemb=<optimized out>, siz=siz@entry=8, compare=compare@entry=0x606400 <php_array_data_compare>)
at /build/php5-pO28mL/php5-5.5.9+dfsg/Zend/zend_qsort.c:123
#3 0x0000000000607e86 in php_array_intersect (ht=<optimized out>, return_value=0xc757cb0, behavior=1, data_compare_type=<optimized out>, key_compare_type=0,
return_value_used=<optimized out>, this_ptr=<optimized out>, return_value_ptr=<optimized out>) at /build/php5-pO28mL/php5-5.5.9+dfsg/ext/standard/array.c:3174
#4 0x00000000006ddbdb in dtrace_execute_internal (execute_data_ptr=<optimized out>, fci=
@leite
leite / relations.lua
Last active November 23, 2015 05:05
find equal ref (from, to) in members of relation
#!/usr/bin/env lua
--
-- find equal ref (from, to) in members of relation
--
-- @author leite <[email protected]>
-- @license GPL version 3
--
assert(arg[1], 'argument should be a file path')
@leite
leite / relations
Created November 23, 2015 02:38
find equal ref (from, to) in members of relation
#!/bin/bash
#
# find equal ref (from, to) in members of relation
#
# @author leite <[email protected]>
# @license GPL version 3
#
relation=0
@leite
leite / .travis.sh
Last active September 7, 2015 07:34
travis script to enable Lua
#! /bin/bash
set -e
export PREFIX=$HOME/.bin && mkdir -p $PREFIX && export PATH=$PATH:$PREFIX/bin
if [ "$(expr substr $LUA 1 6)" == "luajit" ]; then
git clone http://luajit.org/git/luajit-2.0.git luajit && cd luajit
[[ "$LUA" == "luajit2.1" ]] && git checkout v2.1 || git checkout v2.0.4
CFLAGS="$CFLAGS -DLUAJIT_ENABLE_LUA52COMPAT" make
@leite
leite / 0_reuse_code.js
Last active August 29, 2015 14:19
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@leite
leite / Bootstrap.php
Last active August 29, 2015 14:19
trying out slimphp ... managing to get more information out of routes
<?php namespace app;
/**
*
*/
use \Slim\App as App;
use \Slim\Views\Lightncandy as Lightncandy;
define(BLANK, '');
@leite
leite / ftee.c
Created April 7, 2015 09:20
ftee, behaves similarly to tee but clones the stdin to stdout and to a named pipe without blocking
/* ftee - clone stdin to stdout and to a named pipe
(c) racic@stackoverflow
WTFPL Licence */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
@leite
leite / documenting
Created December 9, 2014 06:02
Hello!
# Pinote-service
pinote-service is a web *API* design to pinote app written in [Lua](http://www.lua.org) that runs over [Gin](http://gin.io) and [Openresty](http://openresty.org)
# Table of contents
* [Status](#markdown-header-status)
* [Instalation](#markdown-header-instalation)
* [Deploy](#markdown-header-deploy)
* [API](#markdown-header-api)
* [Overall specifications](#markdown-header-overall-specifications)
* [*](#markdown-header-42)