Skip to content

Instantly share code, notes, and snippets.

@NightFeather
NightFeather / man.sh
Created January 20, 2022 20:31
Use vim as man pager
man () {
LANG=C /usr/bin/man -P "sh -c \"col -b | vim -u NONE -R -c 'syntax on' -c 'set ft=man ts=8 nomod nolist' -\"" $@
}
@NightFeather
NightFeather / screenshot.sh
Last active August 19, 2021 13:59
Screenshit utility for sway.
#!/bin/bash
if [[ $# -lt 1 ]]; then
echo "Usage: $(basename $0) <window|output|region>"
exit 1
fi
function stub() {
if [[ $# -lt 1 ]]; then
exit 1

在 Nextcloud 上架一個即時合作文件編輯平臺

簡介

這邊在講怎麼用 docker 來架起 Nextcloud + Collabora Online + Libreoffice 的即時平臺。

準備

這次會用到 docker 上的三個映像檔

  • nextcloud:18
  • mariadb:10.4
  • libreoffice/online:master
// ==UserScript==
// @name 逢甲微學分選課為啥不標禮拜幾
// @namespace https://gist.github.com/NightFeather/59a14a0beed3e427c1dba4514b4bb7e0
// @description 逢甲微學分選課為啥不標禮拜幾
// @author Nightfeather
// @copyright Nightfeather (https://github.com/Nightfeather)
// @liscense MIT (https://mit-license.org/)
// @version 0.4.1
// @downloadURL https://gist.github.com/NightFeather/59a14a0beed3e427c1dba4514b4bb7e0/raw/micro-timestamp.user.js
// @updateURL https://gist.github.com/NightFeather/59a14a0beed3e427c1dba4514b4bb7e0/raw/micro-timestamp.user.js
#!/usr/bin/env ruby
# frozen_string_literal: true
require 'json'
require "set"
files = {
bgm: SortedSet.new,
bgs: SortedSet.new,
se: SortedSet.new,
(()=>{
let d = document;
let coke = el => {let seg = Array.from({length:4}, () => Math.round(Math.random()*256).toString()).join(",");el.style.backgroundColor="rgba("+seg+")";};
let domcb = () => d.querySelectorAll("div").forEach(coke);
d.addEventListener("DOMContentLoaded", domcb);
let ob = new MutationObserver(domcb);
ob.observe(d.body, { childList: true, subtree: true });
})();
#!/usr/bin/env ruby
require "zip"
f = Zip::ZipFile.open ARGV[1]
f.entries.map do |e|
name = e.name.force_encoding(ARGV[0]).encode("utf-8")
if e.is_directory
system "mkdir", "-p", name
else

AIS3 2019

Day1 Afternoon

賈新聞 bot

prepare

準備一個賈字的來源

method

# coding: utf-8
"""
why module doc always required
"""
import json
import requests
import bs4
import os
# coding: utf-8
"""
why module doc always required
"""
import json
import requests
import bs4
MOZ_UA = "Mozilla/5.0 (X11; Linux x86_64; rv:64.0) Gecko/20100101 Firefox/64.0"