summary refs log tree commit diff stats
path: root/index.html
blob: 98f6a5d4dbcd105b735c8ca4ccee906f6ed3a0d5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<!DOCTYPE html>
<html lang="en">
	<head>
		<title>Runxi Yu</title>
		<link rel="stylesheet" href="/style.css" />
		<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
		<meta charset="utf-8" />
		<style>#now {font-weight: bold;}</style>
		<link rel="me" href="https://social.treehouse.systems/@AndrewYu" />
	</head>
	<body>
		<h1>Runxi Yu</h1>
		<hr />
		<p id="now" style="">
		<b>Recently:</b></br>
		<a href="https://gabrielsieben.tech/2022/07/29/remote-assertion-is-coming-back-how-much-freedom-will-it-take/">Remote attestation contradicts our goals for a free Internet</a>
		<br />
		<a href="https://www.fsf.org/blogs/community/web-environment-integrity-is-an-all-out-attack-on-the-free-internet">``Web Environment Integrity'' is an all-out attack on the free Internet</a>
		<br />
		</p>
		<hr />
		<p id="about-me">I am Runxi Yu, a 15-year-old student in Shanghai, China, currently studying at YK Pao School.  I am interested in philosophy, computer science, mathematics, physics, and biology.</p>
		<p id="pronouns"><a href="/note/pronouns.html">Pronouns</a>: they/she/it/他</p>
		<p id="names">Also known as: Harriet/Andrew</a>
		<hr />
		<ul>
			<li><a href="https://www.andrewyu.org/">My Personal Website</a></li>
			<li><a href="#articles">Personal Articles</a> (<a href="https://www.andrewyu.org/article/atom.xml">rss/atom</a>)</li>
			<li><a href="#faq">FAQ, etc.</a></li>
			<li><a href="/microblog/">Microblog</a></li>
			<li><a href="/contact.html">Contact</a> and Accounts
				<ul>
					<li>Email <code>runxi</code> AT <code>andrewyu</code> DOT <code>org</code></li>
					<li><a href="/contact.html#pgp">OpenPGP</a> <a href="https://www.andrewyu.org/pgp/andrew-ecc.asc"><code>ACF28DC0A2E8D76446B33A2D545412166A37189B</code></a></li>
					<li>IRC <code>Harriet</code> on <a href="https://libera.chat">Libera.Chat</a> or <code>irc.andrewyu.org</code></li>
					<li>Mastodon <a rel="me" href="https://social.treehouse.systems/@AndrewYu"><code>@AndrewYu@social.treehouse.systems</code></a></li>
					<li>sr.ht <a href="https://sr.ht/~andrewyu"><code>~andrewyu</code></a></li>
					<li>GitHub <a href="https://github.com/andrewrunxiyu"><code>@andrewrunxiyu</code></a> (deprecated)</li>
				</ul>
			</li>
			<li><a href="https://git.andrewyu.org/">Git Repositories</a></li>
			<li><a href="https://evosaur.andrewyu.org/">The Evosaur Project</a></li>
			<li><a href="/school/">School Stuff Hub</a></li>
			<li><a href="/other-articles/">Articles by Others I Find Worth Sharing</a></li>
			<li><a href="/buffer.html">Random Buffer Webpage</a></li>
		</ul>
		<hr />
		<h2 id="articles">Personal Articles</h2>
		<p>Pages for other projects (i.e. Evosaur) are not listed&mdash;only independent articles are listed here.  These are sorted from newest to oldest.  Some do not come with HTML anchors: these articles are not published online, but are still listed here.  For these, you may ask me for a copy in real life, but it is within my rights to decline such requests.  Note that if an article ID has an asterisk (*), it is considered fiction and its meaning shall not be interpreted literally.</p>
		<p><a href="https://www.andrewyu.org/article/atom.xml">rss/atom</a></p>
		<ul>
			<li><a href="/article/chinese-pronouns.html">Reclaiming "他" as a gender-inclusive pronoun</a> (23)</li>
			<li><a href="/article/sway-keysym.html">Sway keysym</a> (22)</li>
			<li><a href="/article/affirmative-action.txt">Affirmative Action in Light of Harvard/UNC Case</a> (21)</li>
			<li>Article 20 does not exist</li>
			<li><a href="/article/unicorn.html">Unicorn</a> (19*)</li>
			<li><a href="/article/texmacs-maxima-integral.html">TeXmacs Maxima Integrals</a> (18)</li>
			<li><a href="/article/gender-and-pronouns.html">Gender and Pronouns</a> (17)</li>
			<li><a href="/article/poems-2.html">Poems Collection 2</a> (16*)</li>
			<li><a href="/article/poems-1.html">Poems Collection 1</a> (15*)</li>
			<li><a href="/article/means.html">Means</a> (14*)</li>
			<li><a href="/article/depravity.html">Depravity</a> (13*)</li>
			<li><a href="/article/dream-of-the-whisker.html">Dream of the Whisker</a> (12*)</li>
			<li><a href="/article/purple-hibiscus.html">Random Notes on Purple Hibiscus</a> (11)</li>
			<li><a href="/article/math-science-and-philosophy.html">Math, Science, and Philosophy</a> (10)</li>
			<li><a href="/article/the-old-web-was-better.html">The Old Web Was Better</a> (9)</li>
			<li><a href="/article/free-hardware.html">Free Hardware</a> (8)</li>
			<li>A Fragile Society (7)</li>
			<li><a href="/article/copyright.html">Copyright: It's okay</a> (6)</li>
			<li><a href="/article/democracy-us.html">Democracy: The United States</a> (5)</li>
			<li><a href="/article/democracy-fundamentals.html">Democracy: Fundamentals</a> (4)</li>
			<li><a href="/article/abortion.html">Abortion</a> (3)</li>
			<li><a href="/article/pragmatic-use-of-nonfree-software.html">Pragmatic Use of Nonfree Software</a> (2)</li>
			<li><a href="/article/free-software-education-in-china-and-covid-19.html">Free Software, Education in China and COVID-19</a> (1)</li>
		</ul>
		<hr />
		<h2 id="faq">FAQs and Stuff</h2>
		<ul>
			<li><a href="/note/pronouns.html">My Pronouns</a></li>
			<li><a href="/note/comms.html">Communication Guidelines</a></li>
			<li><a href="/note/wechat.html">``WeChat''</a></li>
			<li><a href="/note/ask.html">Don't ask to ask, just ask</a></li>
			<li><a href="/note/social-media.html">Modern Social Media</a></li>
			<li><a href="/note/emacs.html">My Problem with Emacs</a></li>
			<li><a href="/note/suicide-jokes.html">On Jokes about Suicide</a></li>
			<li><a href="/note/on-racist-jokes.html">On Racist Jokes</a></li>
			<li><a href="/note/tone.html">Tone Indicators</a></li>
			<li><a href="/note/really.html">``Really'' is a confusing word</a></li>
		</ul>
		<hr />
		<h2 id="otherart">Nice Articles from Others</h2>
		<ul>
			<li><a href="https://rosenzweig.io/blog/software-freedom-isnt-about-licenses-its-about-power.html">Software freedom isn’t about licenses – it’s about power</a by Alyssa Rosenzweig></li>
		</ul>
		<hr />
		<h2 id="coolsites">Other People's Sites and Projects</h2>
		<ul>
			<li><a href="https://writefreesoftware.org/">Write Free Software</a></li>
			<li><a href="https://libreboot.org/">Libreboot, a coreboot distribution</a></li>
			<li><a href="https://fedfree.org/">Federation of Freedom</a></li>
			<li><a href="https://vitali64.duckdns.org/">Ferass El Hafidi</a></li>
			<li><a href="https://drewdevault.com/">Drew Devault</a></li>
			<li><a href="https://vimuser.org/">Leah Rowe</a></li>
			<li><a href="https://rosenzweig.io/">Alyssa Rosenzweig</a></li>
		</ul>
		<div id="footer">
			<hr />
			<p>Unless otherwise specified with the ``<span class="copyright">copyright</span>'' HTML/CSS class, works hosted on this subdomain (<code>www.andrewyu.org</code>) served with the HTTP(S) protocol is available under <a href="https://www.andrewyu.org/note/pubdom.html">Runxi Yu's Public Domain Dedication</a>.</p>
		</div>
	</body>
</html>
022-05-22 18:27:48 -0700 committer Kartik K. Agaram <vc@akkartik.com> 2022-05-22 18:29:52 -0700 basic test-enabled framework' href='/akkartik/view.love/commit/main.lua?id=f421e1daa52a52956f40b3ee6d8b527ba1c30d5a'>f421e1d ^
a5f725a ^








81ecca8 ^
475bbd7 ^

2a26a26 ^
81ecca8 ^
b40dab6 ^

8bbc1ff ^
53c3524 ^


b40dab6 ^


8bbc1ff ^
53c3524 ^
8bbc1ff ^
b40dab6 ^
2a26a26 ^

f421e1d ^
a5f725a ^
81ecca8 ^
e83f219 ^

d2d54db ^
a5f725a ^
81ecca8 ^
eaa3820 ^

f421e1d ^
a5f725a ^
81ecca8 ^
bb9e23a ^

83ba9e6 ^
a5f725a ^
81ecca8 ^
ccf7ecc ^

f421e1d ^
a5f725a ^
81ecca8 ^
4aa2003 ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
                     

             
              
 
                  
                
 

                    

                                                                               
                 
 
                                    
                                 
                                                 





                        
   
 
                           



                                                                        

                                         


                                           
                                 

     
                  

                                                              
                                 


                                               
                                 
                                     



             
                                                              
                                 

                                                                                                                           
                                   
                                       


               

       
                                                              



                                                     




                           


                        

                                                                    
                                                              
                                                                               
                                     
                                                                        


                                                              
                                                                       
                                                                            
                                                                                                                                                          
                                           

                                                

   








                                                                                              
   
 
                                             


                                                                               
                                                            
                                           
                                


                                                              
                                                                            

   
                         

                                                                         
                               
                                                                                 

                                                           
                                                                                       
                                  

   
                              
                                                       

                                                           

                                     
                                                                     
                                            
                
                                           
              
                                             
                               
                                   
           

       
                                                                                

   
                   
                      
                         

   
                       








                                                  
                               

   
                    
                         

                                                    
                                        


                                                                                                       


                                                     
                                         
                      
                                                                     
                                                        

   
                                            
                                                                         
                                                            

   
                                             
                                                                         
                                                             

   
                         
                                                                         
                                        

   
                                         
                                                                         
                                                        

   
                                       
                                                                         
                                                       
   
utf8 = require 'utf8'

require 'app'
require 'test'

require 'keychord'
require 'button'

require 'main_tests'

-- delegate most business logic to a layer that can be reused by other projects
require 'edit'
Editor_state = {}

-- called both in tests and real run
function App.initialize_globals()
  -- tests currently mostly clear their own state

  -- resize
  Last_resize_time = nil

  -- blinking cursor
  Cursor_time = 0
end

-- called only for real run
function App.initialize(arg)
  love.keyboard.setTextInput(true)  -- bring up keyboard on touch screen
  love.keyboard.setKeyRepeat(true)

  love.graphics.setBackgroundColor(1,1,1)

  if love.filesystem.getInfo('config') then
    load_settings()
  else
    initialize_default_settings()
  end

  if #arg > 0 then
    Editor_state.filename = arg[1]
    Editor_state.lines = load_from_disk(Editor_state.filename)
    Text.redraw_all(Editor_state)
    Editor_state.screen_top1 = {line=1, pos=1}
    Editor_state.cursor1 = {line=1, pos=1}
    for i,line in ipairs(Editor_state.lines) do
      if line.mode == 'text' then
        Editor_state.cursor1.line = i
        break
      end
    end
  else
    Editor_state.lines = load_from_disk(Editor_state.filename)
    Text.redraw_all(Editor_state)
    if Editor_state.cursor1.line > #Editor_state.lines or Editor_state.lines[Editor_state.cursor1.line].mode ~= 'text' then
      for i,line in ipairs(Editor_state.lines) do
        if line.mode == 'text' then
          Editor_state.cursor1.line = i
          break
        end
      end
    end
  end
  love.window.setTitle('lines.love - '..Editor_state.filename)

  if #arg > 1 then
    print('ignoring commandline args after '..arg[1])
  end

  if rawget(_G, 'jit') then
    jit.off()
    jit.flush()
  end
end

function load_settings()
  local settings = json.decode(love.filesystem.read('config'))
  love.graphics.setFont(love.graphics.newFont(settings.font_height))
  -- maximize window to determine maximum allowable dimensions
  App.screen.width, App.screen.height, App.screen.flags = love.window.getMode()
  -- set up desired window dimensions
  love.window.setPosition(settings.x, settings.y, settings.displayindex)
  App.screen.flags.resizable = true
  App.screen.flags.minwidth = math.min(App.screen.width, 200)
  App.screen.flags.minheight = math.min(App.screen.width, 200)
  App.screen.width, App.screen.height = settings.width, settings.height
  love.window.setMode(App.screen.width, App.screen.height, App.screen.flags)
  Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width-Margin_right, settings.font_height, math.floor(settings.font_height*1.3))
  Editor_state.filename = settings.filename
  Editor_state.screen_top1 = settings.screen_top
  Editor_state.cursor1 = settings.cursor
end

function initialize_default_settings()
  local font_height = 20
  love.graphics.setFont(love.graphics.newFont(font_height))
  local em = App.newText(love.graphics.getFont(), 'm')
  initialize_window_geometry(App.width(em))
  Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width-Margin_right)
  Editor_state.font_height = font_height
  Editor_state.line_height = math.floor(font_height*1.3)
  Editor_state.em = em
end

function initialize_window_geometry(em_width)
  -- maximize window
  love.window.setMode(0, 0)  -- maximize
  App.screen.width, App.screen.height, App.screen.flags = love.window.getMode()
  -- shrink height slightly to account for window decoration
  App.screen.height = App.screen.height-100
  App.screen.width = 40*em_width
  App.screen.flags.resizable = true
  App.screen.flags.minwidth = math.min(App.screen.width, 200)
  App.screen.flags.minheight = math.min(App.screen.width, 200)
  love.window.setMode(App.screen.width, App.screen.height, App.screen.flags)
end

function App.resize(w, h)
--?   print(("Window resized to width: %d and height: %d."):format(w, h))
  App.screen.width, App.screen.height = w, h
  Text.redraw_all(Editor_state)
  Editor_state.selection1 = {}  -- no support for shift drag while we're resizing
  Editor_state.right = App.screen.width-Margin_right
  Editor_state.width = Editor_state.right-Editor_state.left
  Text.tweak_screen_top_and_cursor(Editor_state, Editor_state.left, Editor_state.right)
  Last_resize_time = App.getTime()
end

function App.filedropped(file)
  -- first make sure to save edits on any existing file
  if Editor_state.next_save then
    save_to_disk(Editor_state.lines, Editor_state.filename)
  end
  -- clear the slate for the new file
  App.initialize_globals()  -- in particular, forget all undo history
  Editor_state.filename = file:getFilename()
  file:open('r')
  Editor_state.lines = load_from_file(file)
  file:close()
  for i,line in ipairs(Editor_state.lines) do
    if line.mode == 'text' then
      Editor_state.cursor1.line = i
      break
    end
  end
  love.window.setTitle('Text with Editor_state.lines - '..Editor_state.filename)
end

function App.draw()
  Button_handlers = {}
  edit.draw(Editor_state)
end

function App.update(dt)
  Cursor_time = Cursor_time + dt
  -- some hysteresis while resizing
  if Last_resize_time then
    if App.getTime() - Last_resize_time < 0.1 then
      return
    else
      Last_resize_time = nil
    end
  end
  edit.update(Editor_state, dt)
end

function love.quit()
  edit.quit(Editor_state)
  -- save some important settings
  local x,y,displayindex = love.window.getPosition()
  local filename = Editor_state.filename
  if filename:sub(1,1) ~= '/' then
    filename = love.filesystem.getWorkingDirectory()..'/'..filename  -- '/' should work even on Windows
  end
  local settings = {
    x=x, y=y, displayindex=displayindex,
    width=App.screen.width, height=App.screen.height,
    font_height=Editor_state.font_height,
    filename=filename,
    screen_top=Editor_state.screen_top1, cursor=Editor_state.cursor1}
  love.filesystem.write('config', json.encode(settings))
end

function App.mousepressed(x,y, mouse_button)
  Cursor_time = 0  -- ensure cursor is visible immediately after it moves
  return edit.mouse_pressed(Editor_state, x,y, mouse_button)
end

function App.mousereleased(x,y, mouse_button)
  Cursor_time = 0  -- ensure cursor is visible immediately after it moves
  return edit.mouse_released(Editor_state, x,y, mouse_button)
end

function App.textinput(t)
  Cursor_time = 0  -- ensure cursor is visible immediately after it moves
  return edit.textinput(Editor_state, t)
end

function App.keychord_pressed(chord, key)
  Cursor_time = 0  -- ensure cursor is visible immediately after it moves
  return edit.keychord_pressed(Editor_state, chord, key)
end

function App.keyreleased(key, scancode)
  Cursor_time = 0  -- ensure cursor is visible immediately after it moves
  return edit.key_released(Editor_state, key, scancode)
end