This file contains 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 | |
/** | |
* NestedSets in SQL - How to export a nested set subtree or tree into Yii2 Menu widget and as | |
* JsTree valid DataSet (nested format). | |
*/ | |
class Category extends \yii\db\ActiveRecord | |
{ | |
/** | |
* @return array | |
*/ |
This file contains 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
# for ZSH users | |
sudo apt-get update | |
sudo apt-get install -y git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties | |
sudo apt-get install -y libgdbm-dev libncurses5-dev automake libtool bison libffi-dev | |
# switch to BASH | |
exec bash | |
curl -L https://get.rvm.io | bash -s stable | |
# (if you get error follow the on screen instructions to add the signatures) |
This file contains 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 | |
/* | |
Instructions | |
Go to your php.ini for the web scripts (pointless for cli scripts) | |
Make the following adjustment | |
auto_prepend_file = full/path/to/clousflare_https_prefix.php | |
reload/restart php service (or apache if running via apache) | |
How this works |
This file contains 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 | |
# | |
# Author: Paris Theofanidis | |
# Purpose: All the steps to create an SSL certificate | |
# | |
if [ -z "$1" ] | |
then | |
echo "Provide the name of the certificate to be generated."; | |
echo "To generate a certificate for " | |
echo " mydomain.test" |
This file contains 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
```bash | |
# Rebuild mp3 file | |
find . -name '*.mp3' | parallel 'ffmpeg -y -i {} -c:a libmp3lame -b:a 128k {.}.temp.mp3 && mv {.}.temp.mp3 {}' | |
# normalize | |
find . -name '*.mp3' | parallel 'mp3gain -a -k {}' | |
# cbr (or find the equivalent flags for ffmpeg and do it in one step) | |
find . -name '*.mp3' | parallel 'lame -m j -b 128 --cbr -q 0 {} {.}.temp.mp3 && mv {.}.temp.mp3 {}' |
This file contains 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 | |
use yii\db\ActiveQuery; | |
use yii\db\ActiveRecord; | |
class Account extends ActiveRecord | |
{ | |
public static function tableName() | |
{ | |
return 'account'; | |
} |
This file contains 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
local ret_status="$FG[255]$BG[$THEME_HOST_BG] %m %{$reset_color%} %(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ )" | |
PROMPT='${ret_status} %{$fg[cyan]%}%c%{$reset_color%} $(git_prompt_info)' | |
RPROMPT="[ %D{%H:%M} ]" | |
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}git:(%{$fg[red]%}" | |
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} " | |
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗" | |
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})" | |
This file contains 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 | |
[ | |
'dsn' => 'mongodb://username:password@objectdb.cluster-xxx.eu-central-1.docdb.amazonaws.com:27017/database_name', | |
'options' => [ | |
'ssl' => true, | |
'tlsAllowInvalidCertificates' => true, | |
'tlsAllowInvalidHostnames' => true, | |
'tlsCAFile' => '/apps/certificates/rds-combined-ca-bundle.pem', | |
], | |
] |
This file contains 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
1. First go to the console, click the volume, actions and grow it. | |
2. ssh to the machine | |
```bash | |
> lsblk | |
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT | |
loop0 7:0 0 89.1M 1 loop /snap/core/8039 | |
loop1 7:1 0 18M 1 loop /snap/amazon-ssm-agent/1480 | |
loop2 7:2 0 89.1M 1 loop /snap/core/8213 | |
nvme0n1 259:0 0 40G 0 disk |
This file contains 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
export class Color { | |
/** @type {number} range 0 to 1 */ | |
#r = 0.0; | |
/** @type {number} range 0 to 1 */ | |
#g = 0.0; | |
/** @type {number} range 0 to 1 */ | |
#b = 0.0; | |
/** @type {number} range 0 to 1 */ | |
#h = 0.0; | |
/** @type {number} range 0 to 1 */ |
OlderNewer