This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Uses script and scriptreplay to record and playback virtual terminal. | |
# Copyright (C) 2007 Hean Kuan Ong <[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 2 | |
# of the License, or (at your option) any later version. | |
# | |
# This program is distributed in the hope that it will be useful, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// https://wiki.archlinux.org/index.php/Color_Bash_Prompt | |
$colors = array( | |
// regular colors | |
'black' => '0;30', // black | |
'red' => '0;31', // red | |
'green' => '0;32', // green | |
'yellow' => '0;33', // yellow |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if [ "root" != "$(whoami)" ]; then | |
echo "You must run this command as root" 1>&2 | |
exit 1 | |
fi | |
set -x | |
# Download and extract | |
if [ ! -z "${1}" ]; then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Usage: {script} FILE1 FILE2 ... | |
# | |
# --help, h Displays this help | |
# | |
# Report bugs to Henrique Moody <[email protected]> | |
# | |
_help() | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Bash-Completion script for PHPUnit | |
# | |
# Created by Henrique Moody <[email protected]> | |
# | |
_phpunit() | |
{ | |
COMPREPLY=() | |
local cur="${COMP_WORDS[COMP_CWORD]}" | |
local prev="${COMP_WORDS[COMP_CWORD-1]}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$langinfo = array( | |
'LC_TIME' => array( | |
'ABDAY_1' => 'Abbreviated name of fist day of the week', | |
'ABDAY_2' => 'Abbreviated name of second day of the week', | |
'ABDAY_3' => 'Abbreviated name of third day of the week', | |
'ABDAY_4' => 'Abbreviated name of fourth day of the week', | |
'ABDAY_5' => 'Abbreviated name of fifth day of the week', | |
'ABDAY_6' => 'Abbreviated name of sixth day of the week', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Content from http://en.wikipedia.org/wiki/List_of_HTTP_status_codes | |
* | |
* You may also want a list of unofficial codes: | |
* | |
* 103 => 'Checkpoint', | |
* 218 => 'This is fine', // Apache Web Server | |
* 419 => 'Page Expired', // Laravel Framework |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
return [ | |
// http://www.cidades.ibge.gov.br/download/mapa_e_municipios.php?uf=ac (Thu May 14 16:30:15 BRT 2015) | |
'AC' => [ | |
1200013 => 'Acrelândia', | |
1200054 => 'Assis Brasil', | |
1200104 => 'Brasiléia', | |
1200138 => 'Bujari', | |
1200179 => 'Capixaba', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Usage: {script} PATH | |
# Construct a commit message for use with rebase --autosquash. | |
# | |
# The commit message will be the subject line from the specified commit with a | |
# prefix of "fixup! " and will contain the changes on the PATH. | |
# | |
# --help, -h Displays this help | |
# | |
# Report bugs to Henrique Moody <[email protected]> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Based on https://stackoverflow.com/questions/965611/forcing-access-to-php-incomplete-class-object-properties | |
function convertObject($object, string $from, string $to) | |
{ | |
// Serialize | |
$serialized = serialize($object); | |
// Replace the object-type | |
$objectReplaced = preg_replace( |
OlderNewer