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 | |
# Shell Script to Update AWS EC2 Security Groups | |
# Note that existing IP rules will be deleted | |
# CONFIG - Only edit the below lines to setup the script | |
# =============================== | |
# AWS Profile Name | |
profile="name1" |
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 App\Http; | |
use Illuminate\Foundation\Http\Kernel as HttpKernel; | |
class Kernel extends HttpKernel | |
{ | |
protected $middleware = [ | |
// .. |
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 App\Http\Middleware; | |
use Closure; | |
class InputTrim | |
{ | |
/** | |
* Handle an incoming request. |
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 | |
# replicate_db.sh (c) by Niraj Shah | |
# replicate_db.sh is licensed under a | |
# Creative Commons Attribution-ShareAlike 4.0 International License. | |
# You should have received a copy of the license along with this | |
# work. If not, see <http://creativecommons.org/licenses/by-sa/4.0/>. | |
# https://www.webniraj.com/2017/01/13/replicating-a-remote-mysql-database-to-local-environment-server/ |
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 [ | |
'default' => 'test', | |
'connections' => [ | |
'production' => [ | |
'host' => '111.111.111.111:22', | |
'username' => 'prod', |
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
// see if file exists on remote | |
SSH::into($env)->exists( 'path/on/remote/filename.extension' ); | |
// upload file to remote | |
SSH::into($env)->put( 'path/to/local/filename', 'path/on/remote/filename' ); | |
// run a command - only works on SSH connections | |
SSH::into($env)->run( 'shasum path/on/remote/filename.extension', function( $line ) { | |
// display output of command, by line | |
echo $line; |
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
// get the user's timezone | |
var tz = moment.tz.guess(); | |
console.info('Timezone: ' + tz); | |
// returns: Timezone: Europe/London | |
// set the default user timezone | |
moment.tz.setDefault(tz); | |
// set custom timezone | |
moment.tz.setDefault('America/Los_Angeles'); |
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
# location of keystore | |
storeFile=/path/to/app.keystore | |
# Key alias | |
keyAlias=alias_name | |
# Store password | |
storePassword=Password1 | |
# Key password |
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 | |
// include composer packages | |
include "vendor/autoload.php"; | |
// Create new Landscape PDF | |
$pdf = new FPDI('l'); | |
// Reference the PDF you want to use (use relative path) | |
$pagecount = $pdf->setSourceFile( 'certificate.pdf' ); |
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 | |
/** | |
* Regex example to validate the format of a Emirates | |
* ID number. Does not validate the checkbit (Luhn Algorithm). | |
* | |
* @author Niraj Shah <[email protected]> | |
*/ | |
// regex to validate the format xxx-xxxx-xxxxxxx-x (Emirates ID) |