From Wikipedia, the free encyclopedia

This is for text I use frequently incredibly rarely.

scots

sco-1

sco-2

sco-3

sco-4

sco-N

The code used to generate this
use std::{collections::HashMap, thread};

use chrono::{prelude::*, Duration};
use mediawiki::api_sync::ApiSync};

static ISO_8601_FMT: &str = "%Y-%m-%dT%H:%M:%SZ";

fn make_map(params: &[(&str, &str)]) -> HashMap<String, String> {
    params.iter().map(|(k, v)| (k.to_string(), v.to_string())).collect()
}

fn main() {
    let time_90_days_ago = Utc::now() - Duration::days(90);
    let time_str = time_90_days_ago.format(ISO_8601_FMT).to_string();

    for level in &["1", "2", "3", "4", "N"] {
        println!("== sco-{} ==", level);
        let category = format!("Category:User sco-{}", level);
        let users_query = make_map(&[
            ("action", "query"),
            ("list", "categorymembers"),
            ("cmtitle", &category),
            ("cmprop", "title"),
            ("cmnamespace", "2"), // user
        ]);
        let mut api = ApiSync::new("https://en.wikipedia.org/w/api.php").unwrap();
        api.set_user_agent("QueryActiveUsers/0.1 (/info/en/?search=User:Enterprisey) mediawiki_rs/0.2.0");
        let users = api.get_query_api_json_limit_iter(&users_query, None)
            .map(|user| user.unwrap())
            .filter_map(|user| user["query"]["categorymembers"][0]["title"].as_str().map(ToString::to_string));
        for user in users {
            let user = user.split_terminator('/').next().unwrap();
            let contribs_query = make_map(&[
                ("action", "query"),
                ("list", "usercontribs"),
                ("ucuser", &user),
                ("uclimit", "1"),
                ("ucprop", "timestamp"),
                ("ucend", &time_str),
            ]);
            let contribs = api.get_query_api_json_all(&contribs_query).unwrap();
            let contribs = contribs["query"]["usercontribs"].as_array().unwrap();
            if let Some(t) = contribs.get(0) {
                println!("* {{{{user|{}}}}} {}", user, t["timestamp"].as_str().unwrap().split_terminator('T').next().unwrap());
            }
            thread::sleep(std::time::Duration::from_millis(500));
        }
    }
}

Template for Template:Infobox MTR station replacement

{{Infobox station
|name=
|native_name=
|native_name_lang=zh
|symbol_location=hk
|symbol=wrl
|type=[[Hong Kong]] [[MTR]] rapid transit station
|image=
|caption=
|address=
|borough=
|coordinates_display=inline,title
|latitude=
|longitude=
|line={{HK-MTR box|West Rail}}
|platforms=
|tracks=
|structure=
|code=
|opened={{Start date|YYYY|MM|DD|df=y}}
|services={{s-rail|title=HK-MTR}}
|map_type=Hong Kong MTR
}}

AfC "significant coverage" comment

Please note that for [[WP:N|notability]] to be established, your topic must have received [[WP:GNG|significant coverage]] ([/info/en/?search=Wikipedia:Notability#cite_note-1 for example]) in [[WP:RS|reliable sources]]. Feel free to re-submit once you've added some sources that do this.

What "Input link" is commonly used for

{{edit|Special:MyTalk|'''ask for help on your talk page'''|section=new|preload=Help:Contents/helpmepreload|preloadtitle=Help me!}}

How to make a user script into an auto-gadget-installer

if ( mw.user.options.get('gadget-prosesize') === null ) new mw.Api().saveOption('gadget-prosesize', '1'); (from Special:Diff/926105964)

From Wikipedia, the free encyclopedia

This is for text I use frequently incredibly rarely.

scots

sco-1

sco-2

sco-3

sco-4

sco-N

The code used to generate this
use std::{collections::HashMap, thread};

use chrono::{prelude::*, Duration};
use mediawiki::api_sync::ApiSync};

static ISO_8601_FMT: &str = "%Y-%m-%dT%H:%M:%SZ";

fn make_map(params: &[(&str, &str)]) -> HashMap<String, String> {
    params.iter().map(|(k, v)| (k.to_string(), v.to_string())).collect()
}

fn main() {
    let time_90_days_ago = Utc::now() - Duration::days(90);
    let time_str = time_90_days_ago.format(ISO_8601_FMT).to_string();

    for level in &["1", "2", "3", "4", "N"] {
        println!("== sco-{} ==", level);
        let category = format!("Category:User sco-{}", level);
        let users_query = make_map(&[
            ("action", "query"),
            ("list", "categorymembers"),
            ("cmtitle", &category),
            ("cmprop", "title"),
            ("cmnamespace", "2"), // user
        ]);
        let mut api = ApiSync::new("https://en.wikipedia.org/w/api.php").unwrap();
        api.set_user_agent("QueryActiveUsers/0.1 (/info/en/?search=User:Enterprisey) mediawiki_rs/0.2.0");
        let users = api.get_query_api_json_limit_iter(&users_query, None)
            .map(|user| user.unwrap())
            .filter_map(|user| user["query"]["categorymembers"][0]["title"].as_str().map(ToString::to_string));
        for user in users {
            let user = user.split_terminator('/').next().unwrap();
            let contribs_query = make_map(&[
                ("action", "query"),
                ("list", "usercontribs"),
                ("ucuser", &user),
                ("uclimit", "1"),
                ("ucprop", "timestamp"),
                ("ucend", &time_str),
            ]);
            let contribs = api.get_query_api_json_all(&contribs_query).unwrap();
            let contribs = contribs["query"]["usercontribs"].as_array().unwrap();
            if let Some(t) = contribs.get(0) {
                println!("* {{{{user|{}}}}} {}", user, t["timestamp"].as_str().unwrap().split_terminator('T').next().unwrap());
            }
            thread::sleep(std::time::Duration::from_millis(500));
        }
    }
}

Template for Template:Infobox MTR station replacement

{{Infobox station
|name=
|native_name=
|native_name_lang=zh
|symbol_location=hk
|symbol=wrl
|type=[[Hong Kong]] [[MTR]] rapid transit station
|image=
|caption=
|address=
|borough=
|coordinates_display=inline,title
|latitude=
|longitude=
|line={{HK-MTR box|West Rail}}
|platforms=
|tracks=
|structure=
|code=
|opened={{Start date|YYYY|MM|DD|df=y}}
|services={{s-rail|title=HK-MTR}}
|map_type=Hong Kong MTR
}}

AfC "significant coverage" comment

Please note that for [[WP:N|notability]] to be established, your topic must have received [[WP:GNG|significant coverage]] ([/info/en/?search=Wikipedia:Notability#cite_note-1 for example]) in [[WP:RS|reliable sources]]. Feel free to re-submit once you've added some sources that do this.

What "Input link" is commonly used for

{{edit|Special:MyTalk|'''ask for help on your talk page'''|section=new|preload=Help:Contents/helpmepreload|preloadtitle=Help me!}}

How to make a user script into an auto-gadget-installer

if ( mw.user.options.get('gadget-prosesize') === null ) new mw.Api().saveOption('gadget-prosesize', '1'); (from Special:Diff/926105964)


Videos

Youtube | Vimeo | Bing

Websites

Google | Yahoo | Bing

Encyclopedia

Google | Yahoo | Bing

Facebook