Skip to content

Instantly share code, notes, and snippets.

@Andrew67
Andrew67 / change-permissions-for-unprivileged-container.sh
Last active December 26, 2021 05:10
QNAP LXD Unprivileged Container ACL Fix
#!/bin/sh
# From https://discuss.linuxcontainers.org/t/failing-to-start-unprivileged-container-qnap/12235/9
# Change these values to match your configuration!
CONTAINER_VOLUME="/share/CACHEDEV3_DATA"
CONTAINER_FOLDER="Container"
if [ -z "$1" ] || [ -z "$2" ]; then
echo "Use as $0 [set|unset] <UID>"
@Andrew67
Andrew67 / ios-splash.html
Created May 24, 2020 22:34
iOS splash screen template for use with pwa-asset-generator
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>iOS Splash</title>
<style>
html, body {
height: 100vh;
margin: 0;
<?php
// LICENSE: Public Domain
/**
* Converts a letter to its corresponding regional indicator Unicode character
* @param $chr string The letter to convert (A to Z, case insensitive). If outside this range, it silently wraps around in an undefined manner
* @return string The regional indicator Unicode character
*/
function letter_to_regional_indicator($chr) {
// 0x41 = capital letter A, while the modulo 26 clamps input to A-Z by wrapping around
@Andrew67
Andrew67 / google-maps-static-api.js
Created April 4, 2020 20:50
Google Maps Static API URL Builder
// Google Maps Static API URL Builder
// Sets up a map with a marker to the "current location" and up to 9 other markers for location results
// Note: input to the functions is not validated or sanitized; this is an extract previously used in another project
// LICENSE: Public Domain
function MapBuilder() {
this.url = 'https://maps.google.com/maps/api/staticmap?size=288x216&scale=2&key=API_KEY';
this.nextMarkerNumber = 0;
}
MapBuilder.prototype.getURL = function() { return this.url; };
MapBuilder.prototype.addMyLocationMarker = function(coords) { // Coords in "lat,lng" format
@Andrew67
Andrew67 / cn-browsers-android.md
Last active April 7, 2021 04:55
Chinese browsers for Android

From Fyrd/caniuse#4463

UC Browser: http://sj.qq.com/myapp/detail.htm?apkName=com.UCMobile

  • Version 13.3.3.1113 as of April 5 2021
  • User agent: Mozilla/5.0 (Linux; U; Android 6.0.1; zh-CN; Nexus 5 Build/M4B30Z) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/78.0.3904.108 UCBrowser/13.3.3.1113 Mobile Safari/537.36
  • Ignores the system language setting (which is en-US) in User agent, but Accept-Language is correct
  • Not WebView
  • Package and behavior below differ from Google Play version (Version 13.3.8.1305 in English with no permission prompts etc, used to have outdated Chrome but currently synced on 78)
  • Note: will not launch until Storage permission is denied twice, Location and Phone (make and manage phone calls) are also requested but can be denied once
@Andrew67
Andrew67 / redirect.htaccess
Created June 5, 2019 00:35
Apache .htaccess redirection template
# Redirection template
RewriteEngine On
# HTTP Status Codes
# 301 - Moved Permanently: search engines will consider (and if needed switch to) the destination URL
# 302 - Moved Temporarily: does not cause the above. Default when no code provided after the R flag
# Unconditionally redirect all paths to the target site
RewriteRule ^/?.* https://target.example.com/ [R=301,L]
#!/usr/bin/python
# Version 0.2 2009.01.25
# Copyright (c) 2009, Taoufik El Aoumari
# Released under the GPL license http://www.gnu.org/licenses/gpl-3.0.txt
# Source: https://github.com/taoufix/obsolete-tools/blob/master/scripts/animecheck.sh
# Enhanced fork: https://github.com/OmegaPhil/animecheck/blob/master/animecheck.py
import sys, re, zlib, os
<?php
/**
* RPX Helper Class for JanRain Engage
* @author Andres Cordero
* @license MIT
* See http://www.opensource.org/licenses/mit-license.html
* if LICENSE file not present
* Make sure cURL is installed and allowed to initiate HTTPS connections
*/