Skip to content

Instantly share code, notes, and snippets.

View josecanciani's full-sized avatar

Jose Canciani josecanciani

View GitHub Profile
@josecanciani
josecanciani / object.sh
Last active March 25, 2022 18:37
This file allows creating simple objects in Bash scripts
#!/bin/bash -e
## This helper allows to create simulated objects in Bash
## Source: https://gist.github.com/josecanciani/c036b5c63befa4d09acb1767e2a0b889
##
## USAGE
##
## Lets create a person with first and last name
##
## source /path/to/where/you/downloaded/object.sh
@josecanciani
josecanciani / gitlab-merge-request-diff-file-filter.user.js
Last active January 25, 2022 14:17
Gitlab Merge Request Changes file filtering
// ==UserScript==
// @name Gitlab Merge Request Changes file filtering
// @namespace https://github.com/josecanciani
// @include https://gitlab.com/*/-/merge_requests/*
// @include https://*gitlab*/-/merge_requests/*
// @version 10
// @updateURL https://gist.githubusercontent.com/josecanciani/2e6d1d0b9ce9889eb5ac480219f21e19/raw/gitlab-merge-request-diff-file-filter.user.js
// @author Jose Luis Canciani
// @license GPL version 3 or any later version; http://www.gnu.org/copyleft/gpl.html
// @description This script will provide a filter box to add Regexp filters for files in the list
@josecanciani
josecanciani / avature-custom-styles.user.js
Last active April 19, 2022 14:26
Avature Custom Styles
// ==UserScript==
// @name Avature custom styles
// @namespace https://github.com/josecanciani
// @match https://*.avature.net/*
// @match https://obdbqa*.obfuscate.xcade.dev/*
// @match https://qa*.rebuild.xcade.dev/*
// @version 5
// @author Jose Luis Canciani
// @license GPL version 3 or any later version; http://www.gnu.org/copyleft/gpl.html
// @description This script applies some style changes in Avature webpages.
@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
@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 / 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 / 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 / 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 / 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 / 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