Skip to content

Instantly share code, notes, and snippets.

View ruter's full-sized avatar
:shipit:
Thinking

Ruter ruter

:shipit:
Thinking
View GitHub Profile
@ruter
ruter / change-page-info.js
Last active July 5, 2022 15:43
A script for Notion Palette Command to change current Notion page's title & icon as the date of today.
(async () => {
// The CORS Proxy use to fetch Notion API
// Ref. https://github.com/Rob--W/cors-anywhere#server
const CORS_PROXY = await getEnv("CORS_PROXY");
// Your Notion Internal Integration Token
// Ref. https://www.notion.so/my-integrations
const NOTION_TOKEN = await getEnv("NOTION_TOKEN");
const NOTION_API = CORS_PROXY + "https://api.notion.com/v1/pages/";
@ruter
ruter / slashy_notion_page_current_date.js
Last active July 5, 2022 15:43
A Slashy command script to set current page's icon and title to today.
// ----------------------------------------------------------------------------------
// CONFIGURATION SETTINGS
// ----------------------------------------------------------------------------------
// The CORS Proxy
const CORS_PROXY = "";
// Your Notion Internal Integration Token
// Ref. https://www.notion.so/my-integrations
const NOTION_TOKEN = "";
@ruter
ruter / watsons_beauty.py
Last active November 19, 2021 02:24
屈臣氏小程序签到+造美值任务
#!/usr/bin/env python3
# -*- coding: utf-8 -*
# 屈臣氏 - 造美值中心
import os, re, sys
import json
import time
try:
import requests
@ruter
ruter / aldi_sign.py
Created November 6, 2021 13:39
奥乐齐每日签到脚本
#!/usr/bin/env python3
# -*- coding: utf-8 -*
# 奥乐齐每日签到
import os, re, sys
import json
try:
import requests
except Exception as e:
print(e, "\n缺少requests 模块,请执行命令安装:python3 -m pip install requests")
@ruter
ruter / notion-fixed-toc.js
Created July 14, 2020 05:07
Make Notion's TOC fixed.
// ==UserScript==
// @name Notion Fixed TOC
// @name:zh-CN Notion 浮动 TOC
// @namespace https://notion.cx/
// @version 0.2.0
// @description Make Notion TOC Fixed.
// @description:zh-cn 让 Notion 的 TOC 浮动显示。
// @author Ruter Lü
// @match https://www.notion.so/*
// @grant none
@ruter
ruter / notion-word-count.js
Last active December 29, 2022 16:14
A script for Notion word count.
// ==UserScript==
// @name Notion Page Words Counter
// @name:zh-CN Notion 页面字数统计
// @namespace https://notion.cx/
// @version 0.1.0
// @description Count current page words.
// @description:zh-cn 统计当前页面的字数。
// @author Ruter Lü
// @match https://www.notion.so/*
// @grant none
@ruter
ruter / wordCount.js
Created June 8, 2020 04:57
字符数计算,包含 CJK 字符
var pattern = /[a-zA-Z0-9_\u0392-\u03c9\u00c0-\u00ff\u0600-\u06ff\u0400-\u04ff]+|[\u4e00-\u9fff\u3400-\u4dbf\uf900-\ufaff\u3040-\u309f\uac00-\ud7af]+/g;
function wordCount(str) {
var m = str.match(pattern);
var count = 0;
if (!m) {
return 0;
}
for (var i = 0; i < m.length; i++) {
if (m[i].charCodeAt(0) >= 0x4e00) {
@ruter
ruter / odoo.conf
Created February 26, 2020 01:27 — forked from Guidoom/gist:d5db0a76ce669b139271a528a8a2a27f
Sample odoo.conf file
[options]
#
# WARNING:
# If you use the Odoo Database utility to change the master password be aware
# that the formatting of this file WILL be LOST! A copy of this file named
# /etc/odoo/openerp-server.conf.template has been made in case this happens
# Note that the copy does not have any first boot changes
#-----------------------------------------------------------------------------
# Odoo Server Config File - TurnKey Linux
@ruter
ruter / mdnice.css
Last active February 5, 2020 14:37
My customize CSS for mdnice.com
/*自定义样式,实时生效*/
/*初始化格式*/
#nice {
line-height: 1.6;
letter-spacing: .034em;
color: rgb(63, 63, 63);
font-size: 16px;
word-break:all;
@ruter
ruter / event.js
Last active October 31, 2018 02:17
可用于小程序的发布订阅模式,主要用于跨页面通讯
class Event {
on (event, fn, ctx) {
if (typeof fn != "function") {
console.error('fn must be a function')
return
}
this._stores = this._stores || {}
;(this._stores[event] = this._stores[event] || []).push({cb: fn, ctx: ctx})