In PHP
<?php
$vars = [
'name' => 'Loz'
];
$template = 'Hello {{ name }}!';
#!/usr/bin/env php | |
<?php | |
$file = $argv[1]; | |
$contents = file_get_contents($file); | |
/** @var $patterns */ | |
$patterns = [ | |
/** @lang PhpRegExp */ | |
'~<\?=[ ]?([^?]+);?[ ]?\?>~m' => '{{ $1 }}', |
// derive string key | |
async function deriveKey(password) { | |
const algo = { | |
name: 'PBKDF2', | |
hash: 'SHA-256', | |
salt: new TextEncoder().encode('a-unique-salt'), | |
iterations: 1000 | |
} | |
return crypto.subtle.deriveKey( | |
algo, |
In PHP
<?php
$vars = [
'name' => 'Loz'
];
$template = 'Hello {{ name }}!';
Mostly taken from: https://gitlab.com/sebdeckers/express-history-api-fallback, without all the repo/package fluff.
let staticPath = '/path/to/dist'
app.use(express.static(staticPath))
app.use('/', ((...args) => (req, res, next) => {
if ((req.method === 'GET' || req.method === 'HEAD') && req.accepts('html')) {
(res.sendFile || res.sendfile).call(res, ...args, err => err && next())
#!/bin/bash | |
# | |
# Start all stopped containers | |
# | |
# stop running containers | |
for container in $(lxc list volatile.last_state.power=STOPPED -c n --format csv); do | |
lxc start "$container" | |
done |
Curl requests to access reelgood.com API
<?php
$options = [
'nocache' => 'true',
'kind' => 0,
'minimumScore' => 0,
'sources' => [
'amazon_prime',
'fx_tveverywhere',
0815.ru | |
0815.ru0clickemail.com | |
0815.ry | |
0815.su | |
0845.ru | |
0clickemail.com | |
0-mail.com | |
0wnd.net | |
0wnd.org | |
10mail.com |
#!/bin/bash | |
# | |
# Run command in all running containers | |
# Usage: $ ./lxc-exec-all.sh apt update && apt upgrade | |
# | |
for container in $(lxc list volatile.last_state.power=RUNNING -c n --format csv); do | |
lxc exec "$container" "$@" | |
done |
#!/usr/bin/php | |
<?php | |
/** | |
* Need to test code works on ©Win"virus"dow$ | |
* | |
* Aim: | |
* To run code within a cron task at a settable frequency above 1 per minute, | |
* but not overrun the minute or run again if already running, tasks should | |
* also complete at their own pace within the minute. | |
* |
.nav { | |
nav-prop: 1; | |
.parent-class { | |
parent-prop: 1; | |
&.sibling-class { | |
grand-child-prop: 1; | |
.grand-child-class { |