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
<!-- contents of render-image.html --> | |
{{- $link := split .Destination "#" }} | |
{{- $image := (.Page.Resources.ByType "image").GetMatch (printf "*%s*" (index $link 0)) }} | |
{{- $logo := (resources.Get "images/logo.png") }} | |
{{- if and $image $logo }} | |
{{- $size := math.Round (mul $image.Height 0.25) }} | |
{{- $size := cond (ge $size 80) ($size) (80.0) }} | |
{{- $logo := $logo.Resize (printf "%.0fx jpg" $size) }} |
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
<html> | |
<!-- this one goes in /www/ubuslisten.html --> | |
<meta charset="UTF-8"> | |
<body></body> | |
<script> | |
var source = new EventSource("/cgi-bin/ubuslisten.lua"); | |
source.addEventListener('message', function(e) { | |
console.log(e.data); | |
}, false); |
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 | |
ipset_name="google-ips" | |
ipset_name_tmp="google-ips-tmp" | |
iptables_name="nginx-google-whitelist" | |
port="7654" | |
######################################################### | |
ipset -q create "$ipset_name" nethash |
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 lua | |
local socket = require("socket") | |
local use_ssl, ssl = pcall(require, "ssl") | |
local Blynk = require("blynk.socket") | |
local Timer = require("timer") | |
local http = require("socket.http") | |
assert(#arg >= 1, "Please specify Auth Token") |
To implement Cross-Origin Resource Sharing (CORS) on OpenWRT within Luci
is actually simple.
After very long search, I have found code in uHTTPd
on gitlab, which clearly shows option for CORS
. I haven't found anything, which would describe how to actually configure it.
There is nothing in uHTTPd documentation describing this functionally, /etc/config/uhttpd
does not mention anything either.
Luckily, you can have a look into how the process is starting and what parameters is checking.
doing
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 | |
/** | |
* | |
* This is a quick way to turn a simple text file | |
* with a list of urls in a text file (sitemap-urls.txt) | |
* into a valid XML Sitemap: | |
* http://en.wikipedia.org/wiki/Sitemaps | |
* Put this file sitemap.xml.php and sitemap-urls.txt at | |
* the webroot http://example.com/sitemap.xml.php |