Hello (<-- two spaces)
World
Hello
World
| #!/bin/bash | |
| # | |
| not_root() { | |
| echo "ERROR: You have to be root to execute this script" | |
| exit 1 | |
| } | |
| zram_exists() { | |
| echo "ERROR: /etc/init.d/zram already exists" |
| <?php | |
| namespace NorthernLights\Util; | |
| /** | |
| * Map/replace string accordingly to supplied character map | |
| * Note: | |
| * There is certain overhead because we use 4 function calls main -> mapper -> array_keys -> array_values | |
| * versus that it can be done with just single str_replace() | |
| * However, accordingly to benchmarks, difference becomes noticeable only after 1 000 000 iterations (~300ms slower) |
| #!/bin/bash | |
| # | |
| # git-mv-with-history -- move/rename file or folder, with history. | |
| # | |
| # Moving a file in git doesn't track history, so the purpose of this | |
| # utility is best explained from the kernel wiki: | |
| # | |
| # Git has a rename command git mv, but that is just for convenience. | |
| # The effect is indistinguishable from removing the file and adding another | |
| # with different name and the same content. |
| <?php | |
| /** | |
| * Compares two arrays and shows exact difference between them. | |
| * | |
| * !!! IMPORTANT !! | |
| * Order of two supplied arrays matters! | |
| * | |
| * @fix xZero707 <xzero@elite7hackers.net>: Pay attention to types as well | |
| * |
| <?php | |
| function folderSize ($dir) | |
| { | |
| $size = 0; | |
| foreach (glob(rtrim($dir, '/').'/*', GLOB_NOSORT) as $each) { | |
| $size += is_file($each) ? filesize($each) : folderSize($each); | |
| } |
| # IPB4 Working NGINX site conf file | |
| # Tested on IPB 4.3+ and Centminmod 123.09beta01 | |
| # This file is for a FORCED SSL site. Non-SSL requests will be directed to SSL. | |
| # Replace domain.com with your IP address or domain name. | |
| # IPv6 is now included. | |
| # Replace IPv4 and IPv6 with the actual addresses. | |
| # Information gathered from | |
| # Centminmod.com / Information pulled from multiple guides. Thx eva2000! |
| # This will install PHP with enough extensions to be able to run most of the applications | |
| # More might be needed depending of your app. | |
| sudo add-apt-repository ppa:ondrej/php | |
| sudo apt update | |
| # Replace php7.4 with your arbitary version, eg. php7.1 | |
| sudo apt -y install php7.4 php7.4-{common,json,cli,curl,gd,mysqli,mysqlnd,intl,imagick,gettext,sqlite,apcu,xmlwriter,simplexml} |
| <?php | |
| /** | |
| * Fake headers so it looks like request is coming from SSL | |
| * In my case, I'm hosting app in the isolated docker container behind nginx-proxy. | |
| * For simplicity sake, connection between nginx-proxy and the app is http. | |
| * Connection between nginx-proxy and the client is normally SSL-only (HSTS). | |
| * Wordpress in particular caused problems in this config. | |
| * NOTE: DO NOT USE THIS ON WEBSITE EXPOSED TO THE INTERNET IF SSL SECURITY IS DESIRABLE! | |
| */ | |
| $_SERVER['HTTP_UPGRADE_INSECURE_REQUESTS'] = false; |
Hello (<-- two spaces)
World
Hello
World
| #/bin/sh | |
| # | |
| # The following assumes a default Alpine install using the standard Alpine image | |
| # | |
| # Note: for VirtualBox, you could be tempted to use the `alpine-virt` image, | |
| # however it uses the `virtgrsec` kernel, for which there is no guest additions support | |
| # if required, SSH root password access can be enabled by adding `PermitRootLogin yes` | |
| # to `/etc/ssh/sshd_config` |