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 | |
class GeneratePagesTask extends BuildTask { | |
public function run($request) { | |
for($i = 1; $i < 10; $i++) { | |
$segment = sprintf('page-top-level-%d', $i); | |
$p1 = SiteTree::get_by_link($segment); | |
if(!($p1 && $p1->exists())) { | |
echo "Creating page $i..."; |
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 | |
/** | |
* Remove old tables, columns, and indexes from a SilverStripe database. | |
* | |
* Define your obsolete tables, columns and indexes in {@link $deleted_tables}, | |
* {@link deleted_columns} and {@link deleted_indexes} and these will be deleted | |
* from the database. | |
* | |
* In addition to that, it will automatically remove any tables and columns prefixed with "_obsolete". | |
*/ |
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 | |
# todo: support fpm as well as apache | |
# use bash "strict mode" http://redsymbol.net/articles/unofficial-bash-strict-mode/ | |
set -euo pipefail | |
IFS=$'\n\t' | |
if [ $EUID -ne 0 ]; then | |
echo "This script must be run as root" |
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
## | |
## Windows 10 cleanup script. | |
## Remove dodgy tracking settings, unneeded services, all apps, and optional features that come with Windows 10. Make it more like Windows 7. | |
## NOTE: this was tested on Creators Update (1703) and Fall Creators Update (1709). Some of this may not work as expected on newer versions. | |
## | |
## Instructions | |
## 1. Run this script (under Powershell as Administrator): | |
## powershell -ExectionPolicy Bypass .\cleanup-win10.ps1 | |
## 2. Let it run through, you may see a few errors, this is normal | |
## 3. Reboot |
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 | |
if [ ! -f .php_cs ]; then | |
if [ ! -f .php_cs.dist ]; then | |
exit | |
fi | |
fi | |
EXECUTABLE_NAME="php-cs-fixer" | |
LOCATIONS=( | |
"vendor/bin/$EXECUTABLE_NAME" |
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
#!/usr/bin/env bash | |
set -euo pipefail | |
target=${1:-} | |
subtarget=${2:-} | |
profile=${3:-} | |
release=${4:-snapshot} | |
target_path=$(readlink -f "${5:-$(pwd)}") | |
packages="luci luci-base luci-mod-admin-full luci-proto-relay luci-app-statistics" |
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 | |
set -eu | |
if [ $EUID -ne 0 ]; then | |
echo "This script must be run as root" | |
exit 1 | |
fi | |
ID="cgroup_$((100 + RANDOM % 1000))" | |
echo "Generated cgroup name: $ID" |
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
package main | |
import ( | |
"fmt" | |
) | |
type list struct { | |
head *item | |
tail *item | |
} |
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
package main | |
import ( | |
"fmt" | |
"io/ioutil" | |
"os" | |
) | |
type loader interface { | |
Read() ([]byte, error) |
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
# Simple setup of Ghost in Kubernetes. | |
# | |
# Some points to consider: | |
# - Content is stored in a single persistent disk, and database is SQLite. Using a dedicated database would be ideal | |
# for bigger deployments, and using distributed storage would allow pods to horizontally scale, e.g. GlusterFS, EFS. | |
# | |
# - A load balancer is provisioned for external traffic to access the blog service. For a multi-tenanted approach, | |
# nginx ingress controller (https://kubernetes.github.io/ingress-nginx/deploy/) could be used. | |
# | |
# - No TLS for the service. This could be accomplished using GCP, or AWS managed certs on the load balancer. |
OlderNewer