Skip to content

Instantly share code, notes, and snippets.

@edwardw
edwardw / Cargo.toml
Created December 20, 2019 14:42
Cycle a Rust iterator a given number of times
[package]
name = "cycle_n"
version = "0.1.0"
authors = ["whoever"]
edition = "2018"
[dependencies]
[dev-dependencies]
criterion = "0.3"
@edwardw
edwardw / adapter.rs
Last active December 29, 2019 15:07
AsyncRead adapter
//# bytes = "0.5"
//# futures = "0.3"
//# tokio = { version = "0.2", features = ["stream", "io-util"] }
//# tokio-util = { version = "0.2", features = ["codec"] }
mod adapter {
use futures::io as fio;
use std::{
pin::Pin,
task::{Context, Poll},
};
@edwardw
edwardw / PasswordManager.purs
Created March 8, 2020 08:06
PureScript Run is fun
-- https://haskell-explained.gitlab.io/blog/posts/2019/07/28/polysemy-is-cool-part-1/
module PasswordManager where
import Prelude
import Data.Map (Map)
import Data.Map as M
import Data.Maybe (Maybe(..))
import Data.Tuple (Tuple(..))
import Node.Crypto.Hash (Algorithm(..), base64)
@edwardw
edwardw / readme.md
Last active June 15, 2024 19:27
Android captive portal settings

The android captive portal settings are responsible for the annoying question mark beside the wifi icon. If the device can't connect to the captive portals, the question mark will appear. And at the latest Pixel 8a (android-os 14 I believe), it will also route the traffic through the carrier network which is clearly not desirable.

The settings can be changed by adb (https://gist.github.com/tonyseek/bc5b72197ddb15418c61406061720186):

$ sudo pacman -S android-tools

$ adb shell settings put global captive_portal_https_url <some_server_address>
$ adb shell settings put global captive_portal_http_url <some_server_address>
$ adb shell settings put global captive_portal_fallback_url <some_server_address>
$ adb shell settings put global captive_portal_other_fallback_urls