那为什么说我是“逆流而上“呢?#life #recommended #blog
很明显,在大家都疯了一般在学校里参加各种模拟测试时,我回家自学;在大家都去网吧,打游戏,谈恋爱,追电视剧时,我在写程序;大家都在参加各种比赛拿证的时候,我在社团泡着写程序;大家都在使用成熟框架写程序时,我不厌烦的去尝试自己实现基础功能。我看起来是最傻,最Low的那个臭屌丝,整天沉迷于好像没什么用的程序里,最后却比大多数嘲笑我的人跳的更高。
那为什么逆流的人很少能攀的更高呢?
逆流是一个非常危险的行为,如果把控不好方向很容易走歪。都听说过“博观而约取,厚积而薄发“,却很少有人懂得其本质。现在的人都太浮躁,被大量的毒鸡汤洗脑,希望能一夜成名。尤其是我们的同龄人和后辈,被现在一些不良之风带坏,梦想通过当网红打电竞一夜暴富,过上衣食无忧的生活;或者希望几年,几个月,甚至几周就精通一门专业技术,快速实现自己不切实际的梦想。无论是什么事,没有厚积,哪来的薄发!如果怀揣梦想,一定要脚踏实地的一步一个脚印去实现它,戒骄戒躁,才能有机会去实现它。
最后,任何一个人的成长道路都不是完全相同的,一定要结合自己的实际情况,选择适合自己的道路,并坚定的走下去。我相信任何人都能够逆流而上,活出自己的精彩。
"
谨以此文,纪念我18年的成长历程,送给我的学生,我的学弟学妹,我的后辈以及我自己,希望能够给更多的人启发而走出自己的道路。"来源请求?
另外 duangsuse 之前默写了一些语言名称 #PL #life
Lua C C++ C# Objective-C F# VisualC VisualBasic Basic JavaScript ActionScript Ruby Python Matlab Wolfram Octave Julia Java Kotlin Scala Clojure VHDL Prolog Algor96 Fortran Go
Perl Rust Swift Ada SmallTalk Logo Turtle Crystal Elvish EmacsLisp CommonLisp ChezScheme Racket Haskell Erlang Elixir Idris Dart COBOL Red
Tcl TypeScript RubyMotion Agda PHP REBOL Pascal Coq D OCaml ML Vala Squirrel GDScript
Lua C C++ C# Objective-C F# VisualC VisualBasic Basic JavaScript ActionScript Ruby Python Matlab Wolfram Octave Julia Java Kotlin Scala Clojure VHDL Prolog Algor96 Fortran Go
Perl Rust Swift Ada SmallTalk Logo Turtle Crystal Elvish EmacsLisp CommonLisp ChezScheme Racket Haskell Erlang Elixir Idris Dart COBOL Red
Tcl TypeScript RubyMotion Agda PHP REBOL Pascal Coq D OCaml ML Vala Squirrel GDScript
Forwarded from duangsuse Throws
; MoudleID = 'autumn.ll' 中秋节快乐!
source_filename = "autumn.ll"
@autumn = private constant [10 x i8] c"中秋节\00"
@happy = private constant [11 x i8] c"快乐!\0a\00"
; Function Attrs: noinline nounwind optnone
define i32 @main(i32 %argc, i8** %argv) #0 {
call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @autumn, i32 0, i32 0))
call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @happy, i32 0, i32 0))
call void @exit(i32 0)
unreachable
}
attributes #0 = { noinline nounwind optnone uwtable }
attributes #1 = { noreturn }
declare i32 @printf(i8*, ...)
; Function Attrs: noreturn
declare void @exit(i32) #1
(🙈 假装把这个当成自己的中秋节祝福
中秋节快乐哦,阖家团圆,幸福美满 🌕🍰
#bash #recommended 233333 #haha #tech
https://github.com/benrady/shinatra/blob/master/shinatra.sh
https://github.com/benrady/shinatra/blob/master/shinatra.sh
#!/usr/bin/env bash
RESPONSE="HTTP/1.1 200 OK\r\nConnection: keep-alive\r\n\r\n${2:-"OK"}\r\n"
while { echo -en "$RESPONSE"; } | nc -l "${1:-8080}"; do
echo "================================================"
done
GitHub
benrady/shinatra
A simple web server in 5 lines of bash. Contribute to benrady/shinatra development by creating an account on GitHub.
duangsuse 买的 《Lua 设计与实现》还是 5.1 时代,之前也没听说过,大概是和 ES6 的修改一样吧,同样位长现在允许 number 和 double 同时使用
不用怕损失精度、溢出什么的了 #lua #PL
Androlua+ 虽然 port 了个 Lua5.3 的过去,但是实际上很多特性没有专门介绍(反正讲了很多人也懒得学),包括 number 细化区分
https://www.lua.org/manual/5.3/manual.html#2
There are eight basic types in Lua: nil, boolean, number, string, function, userdata, thread, and table.
The type nil has one single value, nil, whose main property is to be different from any other value; it usually represents the absence of a useful value.
The type boolean has two values, false and true. Both nil and false make a condition false; any other value makes it true.
The type number represents both integer numbers and real (floating-point) numbers.
The type string represents immutable sequences of bytes. Lua is 8-bit clean: strings can contain any 8-bit value, including embedded zeros ('\0'). Lua is also encoding-agnostic; it makes no assumptions about the contents of a string.
The type number uses two internal representations, or two subtypes, one called integer and the other called float.
Lua has explicit rules about when each representation is used, but it also converts between them automatically as needed (see §3.4.3).
Therefore, the programmer may choose to mostly ignore the difference between integers and floats or to assume complete control over the representation of each number.
Standard Lua uses 64-bit integers and double-precision (64-bit) floats, but you can also compile Lua so that it uses 32-bit integers and/or single-precision (32-bit) floats. The option with 32 bits for both integers and floats is particularly attractive for small machines and embedded systems. (See macro LUA_32BITS in file luaconf.h.)
不用怕损失精度、溢出什么的了 #lua #PL
Androlua+ 虽然 port 了个 Lua5.3 的过去,但是实际上很多特性没有专门介绍(反正讲了很多人也懒得学),包括 number 细化区分
https://www.lua.org/manual/5.3/manual.html#2
There are eight basic types in Lua: nil, boolean, number, string, function, userdata, thread, and table.
The type nil has one single value, nil, whose main property is to be different from any other value; it usually represents the absence of a useful value.
The type boolean has two values, false and true. Both nil and false make a condition false; any other value makes it true.
The type number represents both integer numbers and real (floating-point) numbers.
The type string represents immutable sequences of bytes. Lua is 8-bit clean: strings can contain any 8-bit value, including embedded zeros ('\0'). Lua is also encoding-agnostic; it makes no assumptions about the contents of a string.
The type number uses two internal representations, or two subtypes, one called integer and the other called float.
Lua has explicit rules about when each representation is used, but it also converts between them automatically as needed (see §3.4.3).
Therefore, the programmer may choose to mostly ignore the difference between integers and floats or to assume complete control over the representation of each number.
Standard Lua uses 64-bit integers and double-precision (64-bit) floats, but you can also compile Lua so that it uses 32-bit integers and/or single-precision (32-bit) floats. The option with 32 bits for both integers and floats is particularly attractive for small machines and embedded systems. (See macro LUA_32BITS in file luaconf.h.)
此外,Lua 5.3 还加入了位运算特性,也是一个值得注意的部分(貌似 5.2 就有)
Lua 作为嵌入式辅助语言是非常缺少高性能实现啊... 😶
Lua 作为嵌入式辅助语言是非常缺少高性能实现啊... 😶
#javascript #blog (虽然很简单)算法整理
https://blog.lwl12.com/read/ife-s-task01.html "IFE 2015 Summer Game Qihang TASK01"
虽然只是很简单的表达式,我推敲了一会,主要是考虑概率平不平均,实际上很平均(主要是我数学不好 233
Math.random 会返回一个小数,介于 0 到 1 之间
三倍之后,0.1 0.2 0.3 (下的)会舍为 1 ( 0.9 最高
0.4 0.5 0.6 会舍为 2 ( 1.8 最高
0.7 0.8 0.9 会舍为 3 ( 2.7 最高
然后就是
btw: JavaScript 没 goto 语法啊...
不知道能不能再搞个什么特别的加速啥的(billion 级的数据 23333 XD
https://blog.lwl12.com/read/ife-s-task01.html "IFE 2015 Summer Game Qihang TASK01"
Math.ceil(Math.random() * 3)虽然只是很简单的表达式,我推敲了一会,主要是考虑概率平不平均,实际上很平均(主要是我数学不好 233
Math.random 会返回一个小数,介于 0 到 1 之间
三倍之后,0.1 0.2 0.3 (下的)会舍为 1 ( 0.9 最高
0.4 0.5 0.6 会舍为 2 ( 1.8 最高
0.7 0.8 0.9 会舍为 3 ( 2.7 最高
然后就是
function randomPos() {
return Math.ceil(Math.random() * 3);
}
function judge(userPos, botPos) {
if (userPos == botPos) return 0;
// 1: 石头 2: 剪刀 3: 布
if (userPos == 3 && botPos == 1) return -1;
if (botPos == 1 && userPos == 3) return 1;
if (userPos > botPos) return -1;
return 1; // bot wins
}btw: JavaScript 没 goto 语法啊...
不知道能不能再搞个什么特别的加速啥的(billion 级的数据 23333 XD
Forwarded from duangsues.is_a? SaltedFish
JavaScript Number 数值一大就要溢出(划掉)损失精度,气死
还有我的 NodeJS v8 上居然没有 Integer 类,这是为何,而且 "use strict" 了尾递归优化也不能生效...
还有我的 NodeJS v8 上居然没有 Integer 类,这是为何,而且 "use strict" 了尾递归优化也不能生效...
(define fibonacci#cs #pl #scheme Y 组合子版本的 Fibonacci(其实只是我懒得输入
(lambda (nth)
; 不会写了...
))
(fibonacci n 1 2) 然后从 《The Little Schemer》儿童书上抄写的模式 XD至于为什么用 Y Combinator 实现递归是因为我不想多定义一个符号了(
(define fibonacci或者,也可以使用匿名函数版本 这个我没有抄模式...
(lambda (n a b)
(cond
((= 0 n) a + b)
(else (fibonacci (- n 1) b (+ a b))))))
(define fibo (lambda (n) (fibonacci n 1 2)))
(define fibonacci
((lambda (fibonacci-def)
(lambda (n)
(cond
((= n 0) 0)
(else (fibonacci-def fibonacci-def (- n 1) 0 1))))) ; 我把这里能访问到的 fibonacci-def 传给了真正的子程序
(lambda (l nth a b) ; 第一项是这个 lambda 自身
(cond
((= nth 0) (+ a b))
(else (l l (- nth 1) b (+ a b)))))))
; 这是真的演算 lambda
(lambda (nth a b)
(cond
((= nth 0) (+ a b))
(else (fibonacci-def (- n 1)))))
duangsuse::Echo
由于使用了尾调用优化,Chez Scheme 可以轻松地把递归转化为高效率循环,Scheme 使用递归实现循环,目前这居然还是我第一次看到 TCO... 好感动 2333
我的 JavaScript Node v8.x
奇妙的是,它居然还使用了 RangeError...
> fibonacci(999)
1.8412729310978296e+209
> fibonacci(9999)
RangeError: Maximum call stack size exceeded
奇妙的是,它居然还使用了 RangeError...