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 | |
| function addHTTP($url) { | |
| if (!preg_match("~^(?:f|ht)tps?://~i", $url)) { | |
| $url = "http://" . $url; | |
| } | |
| return $url; | |
| } | |
| $testCases = [ | |
| [ |
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/local/bin/bash | |
| # A simple utitlity to SSH easily into remote servers | |
| # You can assign nick names to the IPs, and then use | |
| # the nick to SSH into the particular server | |
| declare -A ips=( \ | |
| [izPanel]=35.185.138.140 \ | |
| [izRepo]=35.196.99.250 \ | |
| ); |
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 | |
| class SequentialLogReader { | |
| private $basePath; | |
| private $logFileName; | |
| private $dayWindow; | |
| private $timeWindow; | |
| private $logProcessor; | |
| public function __construct($basePath, $logFileName, $timeWindow, $dateOffset = null,$dateFormat = null) { |
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 | |
| # An array containing all the paths that | |
| # need to be added to the $PATH variable | |
| PATHS2ADD=( \ | |
| "/home/vikram/scripts" \ | |
| ) | |
| # Loop over the array and | |
| # and add all the paths to |
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 | |
| namespace LoggerPlus; | |
| class LoggerPlus | |
| { | |
| public static function writeDatewiseLog($logdir, $filename, $logstr) | |
| { | |
| $logstr .= "\n"; | |
| if (is_dir($logdir . date('Y'))) { |
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
| grep -Rc "$1" ./ | grep -v ":0" ; |
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
| package main | |
| import ( | |
| "time" | |
| ) | |
| func FormatToStandardTimeString(givenTime time.Time) (string) { | |
| return givenTime.Format("2006-01-02 15:04:05") | |
| } |
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
| package debuggin_helpers; | |
| import ( | |
| "fmt" | |
| ) | |
| func RepresentType(t interface{}) string { | |
| return fmt.Sprintf("--> %#v", t) | |
| } |
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 | |
| class Utils { | |
| public static function getJsonFromQueryResult($qr) { | |
| $arr = array(); | |
| while($row = $result->fetch_assoc()) { | |
| $arr[] = $row; | |
| } | |
| return json_encode($arr); | |
| } |
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 | |
| /** | |
| * Returns a simple formatted string which maybe printed in a log file | |
| * @param $params array | |
| */ | |
| function getFormattedLogString($params) { | |
| $timeStamp = date('Y-m-d H:i:s'); | |
| return "\n".$timeStamp.'!~!'.json_encode($params); | |
| } |
NewerOlder