Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View AlanDecode's full-sized avatar
🛠️
BUILDING

AlanDecode AlanDecode

🛠️
BUILDING
View GitHub Profile
@AlanDecode
AlanDecode / bkp.py
Last active February 24, 2022 16:18
A python script for bookkeeping with notion in terminal!
#!/usr/bin/env python3
"""This is a python script for bookkeeping with notion in CLI.
Author: AlanDecode
Link: https://blog.imalan.cn/archives/track-your-expense-with-notion/
License: MIT
Version: 1.0
First, you need to setup a notion database. Create a database(Table-Full page),
and set its properties(columns) as:
// ==WidgetScript==
// @name 🐼 本期支出
// @description 从 Notion 数据库中统计支出情况
// @icon system:chart.bar.xaxis
// @iconBgColor #04B921
// @param api {string="https://api.imalan.cn/notion_bkp/stat"} API - URL to your metrics data API
// @param token_v2 {string=""} Notion token - 先浏览器登录 Notion,cookie 中名为 token_v2 的字段
// @param db_url {string=""} Database 链接
// @param total_b {string=""} 总支出预算
@AlanDecode
AlanDecode / autofan.py
Last active January 24, 2021 13:18
树莓派风扇控制代码
#!/usr/bin/python3
import time
try:
import RPi.GPIO as GPIO
except RuntimeError:
print("Error importing RPi.GPIO!")
def cpu_temp():
@AlanDecode
AlanDecode / terminal_extend
Last active December 12, 2020 04:54
命令行扩展
alias update_pubkey="curl https://gist.githubusercontent.com/AlanDecode/735f749a0e433c11b552556ca806c429/raw/ > ~/.ssh/authorized_keys"
alias vi="vim"
alias size="du -sh"
alias count="ls -l |grep '^-'|wc -l"
alias gpu="watch -n 1 nvidia-smi"
alias setss="export http_proxy=http://127.0.0.1:7890; export https_proxy=http://127.0.0.1:7890; export all_proxy=http://127.0.0.1:7890"
alias unsetss="unset http_prpxy; unset https_proxy; unset all_proxy"
alias testss="echo Requesting Google...; curl https://google.com"
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDOxELNqPe5f6gYM7itWt/HNMjvx8LN+gGWMT5YyTMht7OSTWWb24GsxhEO2oan92feQxiog149Q1WRyBX8rkf1VRJ+WWXY+MC+18N1M/4aExKqlDT2bXrCEOy+95XeNC0rmXF7dVuZwqKqJ55Tr96idGx3ny+Ozi15FkdQaY2TZYbjImlmGb5SzPrw0YquE8OFtkckG7sHSdWOA5V3olhnmkmxDHnCanAtuvnWE0fNEVKbKmMJ5ThOZhXKu/NG+gnfGKY2xEQFWz8cfxmDwUmEljC7L6Hlkr3XinOsUpf4uURCSNdSZOVHC5nMSXbI7VL8ZQSFeIgxZzC7nObj4p8x alan@MBP_main
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDJRKpr46AVs98wPL3jdkz/w+4Cchx+mflQvIAIPAT0GECdeBjQ2rvglG+Kuk/YaUnQ9u/CCel/ApCZ0ALam/nouEHpp0Igs7RgW9sctqTqt6W48YyS8FbPetKjwSqMmpFah8Gz/BySJjtZPw3zQhFKsUXSqqHAfkYwzZnwzjcfoM9VIzk+U/e+y6eUEiNv5ZtvxQvBu4aj3myjLWbjEci1yEQOe/oKHX9xZ+9roAYB8E8S1a2MmEpFGD3hlRSptsFg3AJFHZdCtpuJCGxsrnNZ1NeIdBm18buXwsiBCytt73DXj91ptEYKqF4vtq0hijdVvejBckvaRoNq3aCVsjlVHU9LwJK80YNjVq2aT8oMrmYdDVG6M6q97jQt60uAjSGTGcrlY0CWBfFZKS+PlBPW0hHUIbwVUWizo5s+dntBAoptUf754Z7MrwNnDzKNmUNBFrpFN6wQB9fhJnIswm09G8SFvPOB3A8RB3OATx8XfUWkesy2AMkeLy6XdvVdnkU= Blink
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDesz/WNuTjOVzHtayjyDv/2A7MBBuXk/
@AlanDecode
AlanDecode / getDownloadInfo.php
Last active May 19, 2020 19:29
从 GitHub API 获取仓库附件下载量。受 API 限制,下载量统计不包括 Source ​code。
<?php
/**
* GitHub Release 下载监控
*
* @author AlanDecode | 熊猫小A
* @link https://www.imalan.cn
* @version 1.0
*/
$UserName = 'AlanDecode';
@AlanDecode
AlanDecode / _readme.md
Created June 10, 2019 11:58 — forked from gka/_readme.md
PHP Endpoint for Github Webhook URLs

PHP Endpoint for Github Webhook URLs

If you love deploying websites using Github, but for some reason want to use your own server, this script might be exactly what you need.

  1. Put github.php somewhere on your PHP-enabled web server, and make it accessible for the outside world. Let's say for now the script lives on http://example.com/github.php
@AlanDecode
AlanDecode / mapTzGeo.js
Last active May 2, 2019 14:31
Map timezone name to latitude and longitude of the city.
// TimeZone => [lat, lon]
var mapTzGeo = {
'America/Denver': [39.7645187, -104.9951977],
'Europe/London': [51.5287352, -0.3817843],
'America/Chicago': [41.8339042, -88.0121562],
'America/Asuncion': [-25.2966809, -57.6681298],
'America/Montevideo': [-34.8207362, -56.3765247],
'Asia/Beirut': [33.8892846, 35.4692627],
'Pacific/Auckland': [-36.8621448, 174.5852782],
'America/Los_Angeles': [34.0207305, -118.6919292],
// 首先需要先引入依赖:
// https://github.com/Triggertrap/sun-js
// https://bitbucket.org/pellepim/jstimezonedetect
var accurateDarkMode = true; // accurateDarkMode 用以设置是使用精确模式(需要用户授权)还是使用大概的模式(不用授权)
var DarkModeSwitcher = {
// TimeZone => [lat, lon]
mapTzGeo : {
'America/Denver': [39.7645187, -104.9951977],
@AlanDecode
AlanDecode / Markdown-Demo.md
Created January 29, 2019 15:18
一份 Markdown 示例文件

二级标题

三级标题

四级标题

五级标题
六级标题