Skip to content

Instantly share code, notes, and snippets.

View dianariyanto's full-sized avatar
🔥
Working from home

Dian Ariyanto dianariyanto

🔥
Working from home
View GitHub Profile
<!-- 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) }}
@oxr463
oxr463 / README.md
Last active May 9, 2023 08:07
OpenWrt JSON-RPC

OpenWrt JSON-RPC

Dependencies

Authentication

@nicopace
nicopace / ubuslisten.html
Created April 25, 2019 13:47
Server-sent events for openwrt on pure lua
<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);
@NatalyaDol
NatalyaDol / image-resize-and-download-canvas.markdown
Last active September 4, 2022 14:11
Image resize and download canvas
@verybadsoldier
verybadsoldier / google_iprange_update.sh
Last active February 9, 2023 12:34
Script to update ipset list "google-ips" with Google IP range
#!/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
#!/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")
@ndunks
ndunks / ZTE-F609.md
Last active March 8, 2024 07:21
Manual help untuk Modem Indihome TELNET ZTE F609

Telnet Manual Modem Indihome

Saya sering lupa, jadi tulis aja di gist.

Login Root via Telnet

telnet 192.168.1.1
login: root

pass : Zte521

@tomasinouk
tomasinouk / CORS_on_OpenWRT_UCI.md
Last active October 11, 2022 08:39
CORS on OpenWRT UCI

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

@artlung
artlung / sitemap.xml.php
Created October 14, 2009 21:42
Generate XML sitemap from list of urls
<?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