duangsuse::Echo
710 subscribers
4.23K photos
127 videos
583 files
6.44K links
import this:
美而不丑、明而不暗、短而不凡、长而不乱,扁平不宽,读而后码,行之天下,勿托地上天国。
异常勿吞,难过勿过,叹一真理。效率是很重要,盲目最是低效。
简明是可靠的先验,不是可靠的祭品。
知其变,守其恒,为天下式;穷其变,知不穷,得地上势。知变守恒却穷变知新,我认真理,我不认真。

技术相干订阅~
另外有 throws 闲杂频道 @dsuset
转载频道 @dsusep
极小可能会有批评zf的消息 如有不适可退出
suse小站(面向运气编程): https://WOJS.org/#/
Download Telegram
duangsuse::Echo
别在意中文变量名 这样比较直观
车夫[n_] = n;
马车[n_] = 车夫[n];
人[n_] = 5*马车[n];
袋子[n_] = 5*人[n];
大猫[n_] = 5*袋子[n];
小猫[n_] = 5*大猫[n];
老鼠[n_] = 5*小猫[n];

腿[n_] = 2*车夫[n] + 0*马车[n] + 2*人[n] + 0*袋子[n] + 4* (大猫[n] + 小猫[n]+ 老鼠[n])
// 15512
#OCR
Forwarded from Rcenyl Liu|工具人
第一条
车夫[n_] = n;
马车[n_] = 车夫[n];
人[n_] = 5*马车[n];
袋子[n_] = 5*人[n];
大猫[n_] = 5*袋子[n];
小猫[n_] = 5*大猫[n];
老鼠[n_] = 5*小猫[n];
腿[n_] = 2*车夫[n] + 0*马车[n] + 2*人[n] + 0*袋子[n] +
4*(大猫[n] + 小猫[n] + 老鼠[n])
第一条输出
15512 n
也就是说腿的数量=15512*n
Forwarded from Rcenyl Liu|工具人
第二条
Solve[腿[n] == 15512, n]
第二条输出
{{n -> 1}}
憨憨的碎碎念 | #成为打工人
Photo
嗯……应该是数量关系定义错了,我乘了下一级的,但没有乘这一级的,所以到最后其实少了一个乘法。

再用关系式描述一遍:

const
laoshu = n => times(4, n),
mao = n => times(n, plus(4, laoshu(5)) ),
damao = n => times(n, plus(4, mao(5) ) ),

类似这样的,不过不好看我就不继续写了
duangsuse::Echo
命令行调用起来有点麻烦,还得写一大堆代码,看来这个灵活性平衡才最重要……
🤔还可以用 Java 写一个。算了还是用 Kotlin 吧
//java.awt.Graphics

data class Dimen(val width: Int, val height: Int)
data class Point(val x: Int, val y: Int)
data class Rect(val position: Point, dimen: Dimen)
typealias Color = IntArray

class Image {
constructor(mode: String, size: Dimen, color: Color)
val size: Dimen
val channels: List<String>
operator fun get(p: Point): Color
operator fun set(p: Point, c: Color)
fun crop(area: Rect): Image
}
class ImageDraw {
var color: Color
var font: Font
fun text(str: String, p: Point)
}

class ColorFuzzyMatch(val distance_max: Int, val ratio: Double)

data class Config(
val font: Font, val font_size: Int, val font_color: Color?,
val scale: Double, val spacing: Dimen, val keyColor: Color,
val fuzzyMatch: ColorFuzzyMatch)
duangsuse::Echo
🤔 private: A(const A&); A& operator= (const A&); 是什么意思 另外我还看见另一个 cv2 的 #Python #code : https://github.com/agm0/python-video-image-montage/blob/master/imagemontage.py
#include <vector>
#include <cv.h>
#include <cxcore.h>
#include <highgui.h>

#include <errno.h>
#include <dirent.h>
#include <iostream>
#include <queue>
#include "picture_montage_class.h"
using namespace cv;
using namespace std;
🤔
This media is not supported in your browser
VIEW IN TELEGRAM
duangsuse::Echo
🤔还可以用 Java 写一个。算了还是用 Kotlin 吧 //java.awt.Graphics data class Dimen(val width: Int, val height: Int) data class Point(val x: Int, val y: Int) data class Rect(val position: Point, dimen: Dimen) typealias Color = IntArray class Image { constructor(mode: String…
非常容易从 PIL 移植到纯 OpenCV,反正只有两个三个主要程序: solveLayout(img, font_size, scale, spacing); drawMontage(img, dest_img, areas, seq_drawable, draw_color)
colorAverageUnlessMatch(fold, img)
🤔
而且比较有可移植性,因为如果只有 OpenCV 有的算法来同时计算均色和背景比率模糊匹配的话移植很麻烦,可现在只需要 Iterable<Color>
(反正学不学 java.awt 和利用 javax.imageio.ImageIO 或 C++ API 我觉得都无所谓,反正我想做一个能利用 SRT subtitle 蒙太奇化视频的 OpenCV 应用
C++ 写的时候总是有内存泄漏的预感,十分莫名其妙(
This media is not supported in your browser
VIEW IN TELEGRAM
好无聊啊,突然 doesn't feel like to do anything 🕊
不想写一个基于 Feed 架构支持 boolean, number, string, name 的函数组织语言
连 State,Variable,introduce,Eq,Both,Either 的关系式求解器也不想写了
也不想继续写 ParserKt 和 org.duangsuse.bin
不对,我想继续写 org.duangsuse.bin ……
想写能看树结构的 GUI …… 🤔

突然觉得那个给 ACE 等 web code editor 支持 parser 的 AGL 好厉害啊,虽然我都没看见 AGL 的 parser 在哪,而且 ParserKt 利用 codegen 也可以做到
……不对,用不着 codegen,反正 Pattern 可以 dynamic construct

我在哪我是谁我要干什么……
#NSFW 对着镜子撸一发?
This media is not supported in your browser
VIEW IN TELEGRAM
https://github.com/itorr/homo/blob/master/homo.js#L1 #JavaScript #code
核心代码,首先我们有一个类似这样的表,eval(xs[i]) == i : ["1", "2"]
function divmod(a, b) { return [Math.trunc(a/b), a%b]; }
function ordFinder(xs, cmp, is_descending = false) {
const sorted = is_descending? xs.sort((a, b) => b-a) : xs.sort();
return function finder(n) {
for (let x of xs) if (cmp(x, n)) return x;
};
}

const findMaxLT = ordFinder(predefined, (a, b) => a < b, true);

function demolish(num) {
if (typeof num != "number") return "";
if (num < predefined.length) return predefined[num];
let [k, div] = divmod(num, findMaxLT(num) );
return `({demolish(k)}*{div}+{deomolish(mod)})`. replace(/\*\(1\)/, "") //*1=itself
}

开始我还以为是自动构造数学表达式然后 filter 呢……
duangsuse::Echo
https://github.com/itorr/homo/blob/master/homo.js#L1 #JavaScript #code 核心代码,首先我们有一个类似这样的表,eval(xs[i]) == i : ["1", "2"] function divmod(a, b) { return [Math.trunc(a/b), a%b]; } function ordFinder(xs, cmp, is_descending = false) { const sorted = is_descending?…
ordFinder(xs, cmp, is_descending) 更简单一点的版本是:
function simpleOrdFinder(xs, is_max, is_lt) {
return ordFinder(xs, is_lt? (a, b) => a<b: (a, b) => a>b, is_max);
}

如果你想要它相对高效地返回项目的索引,必须创建一个 item index <=> sorted index 的双向映射。
Forwarded from dnaugsuz
你朋友就是这样的…… 我还没见过有朋友 ban 我