Skip to content

Instantly share code, notes, and snippets.

View josecanciani's full-sized avatar

Jose Canciani josecanciani

View GitHub Profile
<?php
/**
*
* Last version: https://gist.github.com/josecanciani/ff535426bd5d453ef9c2
*
* Credits (adapted from): https://gist.github.com/doubleking/6117215
*
**/
@josecanciani
josecanciani / gist:f4b40c070bd8a0195b82
Last active August 29, 2015 14:27
mydns-ng prerequisites
# install needed packages
apt-get install build-essential libmysqlclient-dev
if [ -d /usr/lib/x86_64-linux-gnu ]
then
mkdir -p /usr/local/mysql
ln -s /usr/lib/x86_64-linux-gnu /usr/local/mysql/lib
ln -s /usr/lib/x86_64-linux-gnu/libmysqlclient.so.18.0.0 /usr/lib/x86_64-linux-gnu/libmysqlclient.so
ln -s /usr/lib/x86_64-linux-gnu/libmysqlclient.so.18.0.0 /usr/lib/x86_64-linux-gnu/libmysqlclient.a
ln -s /usr/lib/x86_64-linux-gnu/libmysqlclient_r.so.18 /usr/lib/x86_64-linux-gnu/libmysqlclient_r.so
@josecanciani
josecanciani / gist:318b7d67b1e348c3003b
Created August 22, 2015 17:36
mydns-ng compiling (step 2)
# extract code (download from mydns-ng site first)
cd /tmp
tar zxvf mydns-1.2.8.31.tar.gz
cd mydns-1.2.8.31
# depeding on your architecture, provide different lib paths
if [ -d /usr/lib/x86_64-linux-gnu ]
then
./configure — with-mysql-lib=/usr/lib/x86_64-linux-gnu — with-zlib=/lib/x86_64-linux-gnu
else
@josecanciani
josecanciani / gist:a7fa72d0024907a791ce
Created August 22, 2015 17:40
mydns-ng typical configure problems
./configure
# [ ... ]
checking for MySQL support... no
checking for PostgreSQL support... no
checking which database to use... none
configure: error: No supported database found. Either MySQL or PostgreSQL is required.
# OR:
checking for /lib/libz.so... no
checking for /usr/lib/libz.so... no
checking for /usr/local/lib/libz.so... no
@josecanciani
josecanciani / gist:9c182889557254ded5a0
Created January 15, 2016 23:19
google: search for patterns in all files
#!/bin/bash
# A simple bash script that search all files in the current directory finding the words you put on input
# Searches all lines of the file
# Usage: google hello world
if [ -f .google ]
then
rm -f .google
fi
@josecanciani
josecanciani / tegUserStyle.css
Last active February 13, 2017 16:59
TEG User Style
@namespace url(http://www.w3.org/1999/xhtml);
@-moz-document regexp('https://[a-z]+\\.avature\\.net/.*') {
.crmui_SidebarItem{
white-space: pre-line;
}
.SmallSidebarItems .crmui_SidebarItem {
padding: 2px 6px;
@josecanciani
josecanciani / kibanaToTimeTable.php
Last active February 27, 2019 22:48
It takes a -kibana for example- CSV file and creates an HTML page with a time chart. See usage in first comment.
#!/usr/bin/php
<?php
$file = fopen('php://stdin', 'r');
$stdout = fopen('php://stdin', 'r');
$lineNumber = 0;
$code = new Code();
while (!feof($file) && ($line = fgetcsv($file)) !== false) {
if ($lineNumber) { // ignore header
@josecanciani
josecanciani / dna-markdown.user.js
Last active February 1, 2023 17:20
[DEPRECATED] DNA Markdown support
// ==UserScript==
// @name [DEPRECATED] DNA Markdown support
// @namespace https://github.com/josecanciani
// @match https://*.avature.net/DNA/*
// @match https://*.avature.net/_DNA/*
// @version 17
// @deprecated Since DNA now supports Markdown, this script is useless
// @updateURL https://gist.githubusercontent.com/josecanciani/faca999e992f343c3c97269be664466f/raw/dna-markdown.user.js
// @downloadURL https://gist.githubusercontent.com/josecanciani/faca999e992f343c3c97269be664466f/raw/dna-markdown.user.js
// @author Jose Luis Canciani
@josecanciani
josecanciani / exceptionPerformance1.sh
Last active August 12, 2019 21:07
Performance analysis for exceptions in PHP (1)
# All tests running inside a loop of 10 million iterations
# lets first try to add some code for reference. Here we are just creating a standard class
$ time cat <<EOF | php
<?php
for (\$i = 0; \$i < 10000000; ++\$i) {
\$c = new StdClass();
\$c->var = \$i;
rand(\$i, \$i + 1000000);
@josecanciani
josecanciani / exceptionPerformance2.sh
Created August 12, 2019 21:09
Performance analysis for exceptions in PHP (2)
$ time cat <<EOF | php
<?php
for (\$i = 0; \$i < 10000000; ++\$i) {
new Exception(\$i);
rand(\$i, \$i + 1000000);
}
EOF
real 0m2,824s
user 0m2,810s
sys 0m0,017s