Skip to content

Instantly share code, notes, and snippets.

View bycosta's full-sized avatar

Caio Costa bycosta

  • Mérida, Yucatán, México
View GitHub Profile
@danielcosta
danielcosta / post-merge
Created September 17, 2014 17:41
post-merge hook for bob/alice (mobly)
#/usr/bin/env bash
# MIT © Sindre Sorhus - sindresorhus.com
# git hook to run a command after `git pull` or `git merge` if a specified file was changed
# Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep --quiet "$1" && eval "$2"
@nixpulvis
nixpulvis / description_printer.rb
Last active December 14, 2015 15:09
Automatically print tasks description wrapping the execution of the task.
# Automatically print tasks description wrapping the execution of
# the task.
module Capistrano::Configuration::Namespaces
alias_method :_task, :task
def task(name, options = {}, &block)
desc = next_description
full_task_name = [fully_qualified_name, name].compact.join(':')
$column = 0
$last_was_after = true
@kristerkari
kristerkari / lazyeval.html
Last active February 6, 2020 04:00
Lazy evaluating Javascript code
<html>
<body>
<!-- ----------------------------------------------- -->
<!-- inline script block with commented code inside: -->
<!-- ----------------------------------------------- -->
<script id="myjscode">
/*
(function(h,v){function q(b){if(""===m)return b;
@nikic
nikic / php-5.5-features.md
Last active August 31, 2020 10:39
List of new features in PHP 5.5
@juniorb2ss
juniorb2ss / check.py
Last active January 19, 2021 15:10
Python script to make diff for same k:v between different redis db's
#!/usr/local/bin/python3
# -*- coding: utf-8 -*-
from __future__ import print_function
import redis
import json
import time
from itertools import zip_longest
from clint.arguments import Args
@thanksdanny
thanksdanny / LC_CTYPE.txt
Created December 27, 2016 07:46 — forked from jampajeen/LC_CTYPE.txt
Centos warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory
vi /etc/environment
add these lines...
LANG=en_US.utf-8
LC_ALL=en_US.utf-8
@Hounddog
Hounddog / templatemap_generator.php
Created November 29, 2012 13:51
Template Map Generator
#!/usr/bin/env php
<?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
@jddonovan
jddonovan / stress-test.sh
Last active September 27, 2022 01:05 — forked from cirocosta/stress-test.sh
naive http server stress tester using cURL
#!/bin/bash
#### Default Configuration
CONCURRENCY=4
REQUESTS=100
ADDRESS="http://localhost:8080/"
show_help() {
cat << EOF
@nikic
nikic / coroutine.php
Created July 14, 2012 13:25
A coroutine example: Streaming XML parsing using xml_parser
<?php
error_reporting(E_ALL);
/* Data can be send to coroutines using `$coroutine->send($data)`. The sent data will then
* be the result of the `yield` expression. Thus it can be received using a code like
* `$data = yield;`.
*/
/* What we're building in this script is a coroutine-based streaming XML parser. The PHP