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
.PHONY: all tags clean test build install generate image release | |
REGISTRY_REPO = <..redacted..> | |
OK_COLOR=\033[32;01m | |
NO_COLOR=\033[0m | |
ERROR_COLOR=\033[31;01m | |
WARN_COLOR=\033[33;01m | |
# Build Flags |
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
Str::macro('nth_position',function($str, $letter, $n, $offset = 0){ | |
$str_arr = str_split($str); | |
$letter_size = array_count_values(str_split(substr($str, $offset))); | |
if( !isset($letter_size[$letter])){ | |
return false; | |
} else if($letter_size[$letter] < $n) { | |
return false; | |
} | |
for($i = $offset, $x = 0, $count = (count($str_arr) - $offset); $i < $count, $x != $n; $i++){ | |
if($str_arr[$i] == $letter){ |
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
/** | |
* @param $query | |
* @param $relation_name | |
* @param string $operator | |
* @param string $type | |
* @param bool $where | |
* @return mixed | |
*/ | |
public function scopeModelJoin($query, $relation_name, $operator = '=', $type = 'left', $where = false) | |
{ |
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
CREATE TABLE db2.table LIKE db1.table; | |
INSERT INTO db2.table SELECT * FROM db1.table; |
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
Host jumphost | |
Hostname JUMPHOST_IP | |
(User USERNAME_JUMPHOST) | |
Host target | |
Hostname TARGET_IP | |
(User USERNAME_TARGET) | |
ProxyCommand ssh -q -A -x jumphost -W %h:%p |
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
//This input should be from somewhere else, hard-coded in this example | |
$file_name = '2013-07-16.dump.gz'; | |
// Raising this value may increase performance | |
$buffer_size = 4096; // read 4kb at a time | |
$out_file_name = str_replace('.gz', '', $file_name); | |
// Open our files (in binary mode) | |
$file = gzopen($file_name, 'rb'); | |
$out_file = fopen($out_file_name, 'wb'); | |
// Keep repeating until the end of the input file | |
while(!gzeof($file)) { |
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 | |
# Install Some PPAs | |
apt-get install -y software-properties-common | |
apt-add-repository ppa:nginx/stable -y | |
apt-add-repository ppa:ondrej/php5 -y | |
# Update Package Lists | |
apt-get update |
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
# Register All Of The Configured Shared Folders | |
settings["folders"].each do |folder| | |
#config.vm.synced_folder folder["map"], folder["to"], type: folder["type"] ||= nil | |
config.vm.synced_folder folder["map"], folder["to"], | |
id: folder["map"], | |
:nfs => true, | |
:mount_options => ['nolock,vers=3,udp,noatime'] | |
end |
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 | |
$string = str_replace("\xEF\xBB\xBF",'',$string); |