This file contains 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
$ git log -1 | grep ^commit | cut -d " " -f 2 | |
dab96492ac7d906368ac9c7a17cb0dbd670923d9 | |
$ git log -1 | grep ^commit | awk '{print $2}' | |
dab96492ac7d906368ac9c7a17cb0dbd670923d9 |
This file contains 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 | |
DOMAIN="easyforex" | |
POT="$DOMAIN.pot" | |
LANGS="en_US ru_RU" | |
SOURCES="*.php" | |
# Create template | |
echo "Creating POT" | |
rm -f $POT |
This file contains 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 | |
// Before: composer require monolog/monolog | |
// composer autoloader | |
require_once 'vendor/autoload.php'; | |
// Shortcuts for simpler usage | |
use \Monolog\Logger; | |
use \Monolog\Formatter\LineFormatter; | |
use \Monolog\Handler\StreamHandler; |
This file contains 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/php | |
<?php | |
$in = empty($argv[1]) ? '' : $argv[1]; | |
$out = empty($argv[2]) ? '' : $argv[2]; | |
if (empty($out)) { | |
$out = basename($in, '.ini') . '.json'; | |
} |
This file contains 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 | |
interface LoggerInterface { | |
public function __construct($prefix = null); | |
public function log($message); | |
} | |
class Log1 implements LoggerInterface { | |
protected $prefix; |
This file contains 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
1. Copy ssh public key to rsync.net server: | |
[jim@mb hbdev]$ scp ~/.ssh/id_rsa.pub XXXX@usw-s002.rsync.net:.ssh/authorized_keys | |
Password: | |
id_rsa.pub | |
100% 392 0.4KB/s 00:00 | |
2. Create a local HashBackup backup directory: |
This file contains 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 | |
/** | |
* This script shows an example of how merge two arrays, | |
* where one array contains instances of Products, and the | |
* second array contains **multiple** instances of Product | |
* Attributes, and where the records in both arrays are | |
* linked via some value ($product->id == $attribute->product_id). | |
*/ | |
/** |
This file contains 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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains 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 | |
# Chart total number of web requests per hour using Google Charts | |
# Usage: chart_web_request.sh [DATE] [PATH] | |
# | |
# If DATE is not given, yesterday is used. Date should be in the format | |
# that your web server is using in access logs | |
# | |
# If PATH is not given /var/log/httpd/*-access_log is used. | |
# |
This file contains 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 | |
/** | |
* Read file line-by-line from given byte offset. | |
* Handy for re-processing large logs files. | |
*/ | |
// Filename to use for temporary data | |
define('DATA_FILE', 'data.log'); | |
// Create the data file on the fly |
NewerOlder