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 common\models; | |
| trait MasterTrait | |
| { | |
| public static function getDb() | |
| { | |
| $connection = clone \Yii::$app->getDb(); | |
| $connection->enableSlaves = false; | |
| return $connection; |
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 background job automatically locks your Workstation after a specified amount of | |
| # time. It will come in handy if you cannot access the screensaver settings due to policy | |
| # restriction but want to lock your screen after a idle timeout. Or you could just | |
| # press [Win]+[L] everytime you leave your desk ;) . | |
| # | |
| # start with | |
| # powershell.exe -windowstyle hidden -executionpolicy Unrestricted P:\ATH\TO\logoff.ps1 | |
| # | |
| # `-windowstyle hidden` will make your PowerShell disappear/run in background |
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/sh | |
| # Enable and disable HDMI output on the Raspberry Pi | |
| is_off () | |
| { | |
| tvservice -s | grep "TV is off" >/dev/null | |
| } | |
| case $1 in |
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 | |
| apt-get update | |
| echo mysql-server-5.5 mysql-server/root_password password PASSWORD | debconf-set-selections | |
| echo mysql-server-5.5 mysql-server/root_password_again password PASSWORD | debconf-set-selections | |
| apt-get install -y mysql-common mysql-server mysql-client | |
| apt-get install -y apache2 |
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
| /* | |
| No jQuery necessary. | |
| Thanks to Dan's StackOverflow answer for this: | |
| http://stackoverflow.com/questions/123999/how-to-tell-if-a-dom-element-is-visible-in-the-current-viewport | |
| */ | |
| function isElementInViewport(el) { | |
| var rect = el.getBoundingClientRect(); | |
| return ( | |
| rect.top >= 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
| #!/bin/bash | |
| # bash generate random alphanumeric string | |
| # | |
| # bash generate random 32 character alphanumeric string (upper and lowercase) and | |
| NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1) | |
| # bash generate random 32 character alphanumeric string (lowercase only) | |
| cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 32 | head -n 1 |
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
| <!-- Place anywhere in the <body> of your page replacing :name with a GitHub username and :repo with a repository name --> | |
| <a href='http://github.com/:name' class='github-anywhere github-anywhere-user' data-user=':name'>Follow :name on GitHub</a> | |
| <a href='http://github.com/:name/:repo' class='github-anywhere github-anywhere-watch' data-user=':name' data-repo=':repo'>Watch :name/:repo on GitHub</a> |