SSH into Root
$ ssh root@123.123.123.123
Change Root Password
<?php | |
$browsers = array('firefox','chrome','safari','opera','msie'); | |
$browser = new stdClass(); | |
preg_match('#('.implode('|',$browsers).')(/| )([^ ]+)#i',$_SERVER['HTTP_USER_AGENT'],$match); | |
$browser->version = round((int)$match[3]); | |
$match = strtolower($match[1]); | |
foreach($browsers as $val) | |
{ |
sudo apt-get update | |
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password password root' | |
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password root' | |
sudo apt-get install -y vim curl python-software-properties | |
sudo add-apt-repository -y ppa:ondrej/php5 | |
sudo apt-get update | |
sudo apt-get install -y php5 apache2 libapache2-mod-php5 php5-curl php5-gd php5-mcrypt php5-readline mysql-server-5.5 php5-mysql git-core php5-xdebug |
#!/usr/bin/env bash | |
uninstall() { | |
list=`gem list --no-versions` | |
for gem in $list; do | |
gem uninstall $gem -aIx | |
done | |
gem list | |
gem install bundler | |
} |
SSH into Root
$ ssh root@123.123.123.123
Change Root Password
This gist is in response to a question asked on the Reddit Angular JS forum about how to structure an Angular app with roles and permissions.
There are many ways to approach this, but I'll share one that I've used before and maybe it will give you an idea. I'd combine all of the above into a single app and control who gets to see what using permissions. There are a few components to this approach...
First off I'd advise creating some sort of local session management service. This should be able to track whether you have an authenticated user and- if so- what types of permissions that user has. (Lots of ways to manage permissions. I'll assume your user object has either a 'role' enum or something simple like an array of string permissions.) You could roll your own session service or you could check out something like satellizer.
Let's assume yo
#Inspection Tools with homebrew-php#
##Prerequisites##
##Step 1: Installing homebrew-php##
brew tap homebrew/dupes
brew tap josegonzalez/homebrew-php
brew install PHP53
(or other version of your choice)Paste this Code in Validator.php | |
public function validateAlphaSpaces($attribute, $value, $params) | |
{ | |
return preg_match('/^[\pL\s]+$/u', $value); | |
} | |
Create Custom Message some where at bottom in Validation.php | |
/* |
Translations: Korean (by Yongwoo Lee)
Laravel has a powerful Inversion of Control (IoC) / Dependency Injection (DI) Container. Unfortunately the official documentation doesn't cover all of the available functionality, so I decided to experiment with it and document it for myself. The following is based on Laravel 5.4.26 - other versions may vary.
I won't attempt to explain the principles behind DI / IoC here - if you're not familiar with them you might want to read What is Dependency Injection? by Fabien Potencier (creator of the Symfony framework).
# Backup | |
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql | |
# Restore | |
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE | |