/
index.html
313 lines (253 loc) · 22.9 KB
/
index.html
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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en-us">
<head>
<meta name="generator" content="Hugo 0.68.3" />
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">
<title>
idkhtblog · I don't know how to blog
</title>
<link rel="stylesheet" href="/css/poole.css">
<link rel="stylesheet" href="/css/syntax.css">
<link rel="stylesheet" href="/css/lanyon.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=PT+Serif:400,400italic,700|PT+Sans:400">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/assets/apple-touch-icon-144-precomposed.png">
<link rel="shortcut icon" href="/assets/favicon.ico">
<link rel="alternate" type="application/rss+xml" title="RSS" href="/atom.xml">
</head>
<body>
<input type="checkbox" class="sidebar-checkbox" id="sidebar-checkbox">
<div class="sidebar" id="sidebar">
<div class="sidebar-item">
<p>
Collection of ideas. Powered by <a href="https://gohugo.io/getting-started/quick-start/">Hugo</a>, theme based on <a href="https://lanyon.getpoole.com/">Lanyon</a>.
</p>
</div>
<nav class="sidebar-nav">
<a class="sidebar-nav-item active " href="/">Home</a>
<a class="sidebar-nav-item " href="/posts">Posts</a>
<a class="sidebar-nav-item " href="/about">About</a>
</nav>
<div class="sidebar-item">
<p>© 2021. All rights reserved.</p>
</div>
</div>
<div class="wrap">
<div class="masthead">
<div class="container">
<h3 class="masthead-title">
<a href="/" title="Home">idkhtblog</a>
<small>I don't know how to blog</small>
</h3>
</div>
</div>
<div class="container content">
<div class="posts">
<div class="post">
<h1 class="post-title"><a href="https://franklinliang.github.io/posts/homelab-1/">Homelab 1</a></h1>
<span class="post-date">May 5, 2021</span>
<h1 id="why-how-and-what">Why, How and What</h1>
<p>I felt incredible joy after finishing my final exam of the term following 12 months of continuous schooling. But less than 72 hours later I was already bored. I needed something to do, so I made the Friedman translator. This was a project that would normally take me weeks due to dealing with school, but I finished it in under two days. I needed a bigger project.</p>
<blockquote>
<p>“Hey I’m picking up some furniture from the office, maybe we can get a server too.”</p>
</blockquote>
<p>That’s all I needed to hear. 6 hours of backbreaking labour later, we fit a whole office worth of furniture (plus a server) into two trips in the minivan. Now it was time to get to work.</p>
<p>The server is a Dell R710. I did not know what a Dell R710 was at the time of taking the server and I definitely did not know how to set it up. Physically, the server is pretty big and deceptively heavy. It came with 10 gigabit ports and four drive bays. In my mind I was already fawning over the hardware. Too bad I didn’t know what I really should have been looking for…</p>
<h1 id="the-setup">The setup</h1>
<p>First thing I did was search up how to configure an R710. That’s when I found my first problem.</p>
<p>iDRAC.</p>
<p>Every single guide on how to setup the R710 seemed to need iDRAC. iDRAC stands for integrated Dell Remote Access Controller. This nifty port would allow me to access my R710 over a network and perform some expediated updates and put an OS on the system. The iDRAC slot on my R710 was empty. Dang.</p>
<p>Thankfully the R710 used to be a favourite of the sub-reddit <a href="https://www.reddit.com/r/homelab/">/r/homelab</a>. I use past tense because while there is good documentation for using R710s, it is now on /r/homelab’s no-buy list due to issues with age. Ok, fine, whatever, as long as it works I’ll be happy. It’s a learning experience right?</p>
<h2 id="firmware">Firmware</h2>
<p>I found some tips on how to update the firmware on <a href="https://www.reddit.com/r/homelab/comments/5ldiel/so_you_wantgot_an_r710/">this mega-post</a> for configuring R710s. The link to the firmware update in that post is dead, but I found another <a href="https://enterprisehomelab.blogspot.com/2020/12/dell-r710-update-iso.html">website hosting the file</a>. I then imaged the iso onto a usb and plugged it into the server. The remainder of the night was spent figuring out why the firmware update would crash. It displayed a cryptic error message that lead me down many stackoverflow rabbit holes.</p>
<p><img src="/static/assets/homelab-1/error.jpeg" alt="Error"></p>
<p>My saviour was a reddit post where a user had similar error messages to my own and their solution was… to image the iso to a disc. Ok I mean why not, I’ll try this tomorrow.</p>
<p>And it totally worked. I had to find an ancient laptop that still had a disc drive, but I imaged the iso to a DVD and voila, the server was updating firmware. The next step was to configure the hard drives.</p>
<h2 id="raid">RAID</h2>
<p>When we took the server it came with four hard drives inside the slots. Two were 250 GB drives and two were 160 GB drives. Alongside these, we also took two additional 250 GB drives. The plan was to swap out the 160 GB drives with the extra 250 GB drives to have ~1TB of storage.</p>
<p>I swapped both drives out and booted up the server. I went to configure the storage and… one of the drives would not show up in the menu. It wasn’t missing, it just refused to show up. The light on the front of the drive was also not on, so I assumed it was busted. Ok I’ll just go with three drives for now as a test. I configured the RAID and restarted.</p>
<p>Error messages, error messages everywhere. The drive was missing. The third drive would appear as missing every single time I restarted the server after a RAID configuration.</p>
<p>I tried for a few hours to get the drives to work, but even if I managed to get the RAID to work through the startup, it would instantly fail when I tried to install Ubuntu. The virtual drive would not show up and instead a single 250 GB drive would be the only option.</p>
<p>In the end I just put back the two original 160 GB drives and miraculously that was able to work. I don’t know why the 250 GB drive would detect and then go missing. It’s a mystery to me, but I didn’t care. Ubuntu was telling me I had a single virtual drive, and from there it was easy street.</p>
<h1 id="what-now">What now</h1>
<p>I don’t know what I’m going to run on the server but at least it is functioning. Maybe I’ll start a Jellyfin server or something. But that’s for another time.</p>
</div>
<div class="post">
<h1 class="post-title"><a href="https://franklinliang.github.io/posts/elliotte-friedman/">Elliotte Friedman</a></h1>
<span class="post-date">May 1, 2021</span>
<h1 id="who-is-elliotte-friedman">Who is Elliotte Friedman?</h1>
<p>This is Elliotte Friedman.</p>
<blockquote class="twitter-tweet"><p lang="en" dir="ltr">Tonight's edition of <a href="https://twitter.com/scotiabank?ref_src=twsrc%5Etfw">@scotiabank</a> Wednesday Night Hockey begins NOW on <a href="https://twitter.com/Sportsnet?ref_src=twsrc%5Etfw">@Sportsnet</a> -- CAL/MON</p>— Elliotte Friedman (@FriedgeHNIC) <a href="https://twitter.com/FriedgeHNIC/status/1382461160923017218?ref_src=twsrc%5Etfw">April 14, 2021</a></blockquote>
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
<p>CAL and MON are not abbreviations. With this translator now you can make an educated guess as to what ELF is trying to say.</p>
<div>
What did Elliot Friedman say this time: <input type="text" id="myText">
<button onclick="friedman()">Decipher</button>
<p id="result"></p>
<script>
function friedman() {
var acronym = document.getElementById("myText");
var teams = ["Anaheim Ducks", "Arizona Coyotes", "Boston Bruins", "Buffalo Sabres", "Calgary Flames", "Carolina Hurricanes", "Chicago Blackhawks", "Colorado Avalanche", "Columbus Blue Jackets", "Dallas Stars", "Detroit Red Wings", "Edmonton Oilers", "Florida Panthers", "Los Angeles Kings", "Minnesota Wild", "Montreal Canadiens", "Nashville Predators", "New Jersey Devils", "New York Islanders", "New York Rangers", "Ottawa Senators", "Philadelphia Flyers", "Pittsburgh Penguins", "San Jose Sharks", "St. Louis Blues", "Tampa Bay Lightning", "Toronto Maple Leafs", "Vancouver Canucks", "Vegas Golden Knights", "Washington Capitals", "Winnipeg Jets"];
var counter = 0;
var fteams = [];
for (team in teams) {
var letters = acronym.value.toUpperCase().split('');
var format_team = teams[team].toUpperCase().replace(" ","");
if (format_team[0] == letters[0]) {
for (character in format_team) {
if (letters != []) {
if (format_team[character] == letters[0]) {
letters = letters.slice(1);
};
};
};
};
if (!letters.length) {
fteams.push(teams[counter]);
};
counter += 1;
};
document.getElementById("result").innerHTML = fteams.join(", ");
};
</script>
</div>
</div>
<div class="post">
<h1 class="post-title"><a href="https://franklinliang.github.io/posts/first-person-ahk/">First Person AHK</a></h1>
<span class="post-date">Mar 12, 2021</span>
<h1 id="introduction">Introduction</h1>
<p>The first time I had ever used AHK was back in highschool. My friend made a Discord bot called “Starmine” that would give out points whenever a user typed !starmine.</p>
<p>It was a fun incremental/idle game that we all played, and while you could wait for the passive point generation, the fastest way to get points was to type !starmine.</p>
<p>The game got really competitive and as we went into the summer months and I needed a way to edge out the competition.</p>
<p>Enter AHK.</p>
<p>A few minutes of searching yielded this language that was easy to use for a programming beginner (me).</p>
<p>Back in 2017, the wiki for AHK was a little lacking in detail but I was able to piece together a simple script, with some help from reddit, which automated the Starmine game. Success!</p>
<h1 id="elite-afk">Elite: AFK</h1>
<p>Fast forward to Christmas 2020, more than three years since I last touched AHK. My friend introduced me to a game called Elite: Dangerous, a mind numbing MMO that I have developed a love-hate relationship with in my three months of experience.</p>
<p>Within this game there are several unfun gameplay loops that you need to master in order to progress to the more fun portions of the game. One of these loops is gathering engineering materials.</p>
<p>Smart players figured out the most efficient way to gather each type of material and compiled it into a spreadsheet.</p>
<p>There within lies the dreaded Jameson’s Crashed Python. This method of collecting encoded data requires the player to point and click three beacons around the player, and then log out and log back in to reset the beacons.</p>
<p>This is not gameplay. I don’t know what this is, but it is definitely not gameplay.</p>
<p>My friend had been playing this game for five years and has done this task hundreds of times. So I dusted off AHK and got to work.</p>
<p>I couldn’t recognize the AHK docs the first time I opened them up. They were so neatly organized, the style was much better and it was apparent that a lot of effort went into making examples.</p>
<h1 id="planning-the-script">Planning the script</h1>
<p>From the get-go I scoped out some issues I knew would suck.</p>
<ol>
<li>How do I pan the camera</li>
<li>How do I deal with loading screens</li>
</ol>
<p>Everything else could be accomplished with sequential keypresses.</p>
<h1 id="panning-the-camera">Panning the camera</h1>
<p>AHK has the ability to move a cursor to a specific point on the screen using the <code>MouseMove</code> function. However, this doesn’t work in first person games.</p>
<p><img src="/static/assets/First-Person-AHK/MouseMove.jpg" alt="MouseMove"></p>
<p>You can’t move the mouse to a point further than the edge of the screen. I needed a way to move the mouse in a direction instead of to a point.</p>
<p>After searching the AHK forums, I stumbled upon a library called LLMouse written by evilC.</p>
<blockquote>
<p><a href="https://www.autohotkey.com/boards/viewtopic.php?f=19&t=26137">https://www.autohotkey.com/boards/viewtopic.php?f=19&t=26137</a></p>
</blockquote>
<p>A copy of the library can be found <a href="/static/assets/First-Person-AHK/LLMouse.ahk">here</a> (fetched December 2020)</p>
<p>The description says, “a library to send low level mouse input”. The library comes with a function <code>LLMouse.Move(x, y, times, rate)</code> which lets us move the mouse some number of units in a direction. It also lets us specify the speed and multiplier for movement.</p>
<p>Perfect, now we can pan the camera by sending relative movement input. Even if the mouse hits the side of the screen, we can continue to move the mouse.</p>
<h1 id="loading-screens">Loading screens</h1>
<p>The other parts of the script can be timed or done sequentially. Loading screens are a different issue as the time it takes to get through the loading screen varies from computer to computer.</p>
<p>Looking through the AHK wiki, I found a function called <code>PixelGetColor</code> which allows AHK to obtain the color of a specified pixel.</p>
<p><img src="/static/assets/First-Person-AHK/Loading1.jpg" alt="First Loading Screen"></p>
<p>The first loading screen is between exiting the game and entering the main menu. The program looks for a light blue pixel that should remain the same across all game versions.</p>
<p><img src="/static/assets/First-Person-AHK/Loading2.jpg" alt="Second Loading Screen"></p>
<p>The next loading screen is between the main menu and entering the game. The program looks for when the black color of the loading screen stop showing up. I didn’t pick a color that appears on screen after the loading finishes because different ships have varying colors and users can customize the HUD colors.</p>
<h1 id="all-done-sort-of">All done! Sort of…</h1>
<p>The code was pretty simple to work out but there are still many things to improve. The script only works for 1980x1080 resolution since the camera movements are hard-coded. I believe that I could calculate the ratio of movement required to move from one beacon to the next, meaning that a user would only have to modify one parameter to adjust the overall camera movement.</p>
<p>The biggest issue is the reliability of the SRV positioning. I have a screenshot in the repo for the script but it is still unreliable.</p>
<p>There was a bug where the exit script button doesn’t work sometimes. I’m not actually sure what the issue with that is, I would love it if someone would let me know.</p>
<p>The repo can be found <a href="https://github.com/FranklinLiang/Jameson">here</a>.</p>
<hr>
<h3 id="notes">Notes</h3>
<p>This entire project is Matthew’s fault, and will not be maintained while I have ragequitted Elite. Feel free to make it better and fix it up yourself.</p>
</div>
<div class="post">
<h1 class="post-title"><a href="https://franklinliang.github.io/posts/how-to-run-a-tor-relay-as-a-student-for-free/">How to run a Tor relay as a student for free</a></h1>
<span class="post-date">Jan 31, 2021</span>
<blockquote>
<p>This post is based on Robert DeVore’s “Run a Tor relay” found here:
<a href="https://www.robertdevore.com/run-a-tor-relay/">https://www.robertdevore.com/run-a-tor-relay/</a></p>
</blockquote>
<p>Tor is a service used by thousands of people everyday to access the internet safely and anonymously.</p>
<p>While I have been using Tor for quite some time, it always seemed daunting to help the Tor network by running a relay. Horror stories about getting mail from ISPs relating to the traffic of anonymous users accessing illegal materials masked by your IP.</p>
<p>This is a common misconception that just by running a relay, you run the risk of being targeted by authorities.</p>
<h1 id="types-of-tor-relays">Types of Tor relays</h1>
<blockquote>
<p>Parts of this are abridged from the EFF’s page on Tor relays:
<a href="https://www.eff.org/pages/what-tor-relay">https://www.eff.org/pages/what-tor-relay</a></p>
</blockquote>
<p>There are three different types of Tor relays: middle relays, exit relays, and bridges. Each serve an important purpose, however the risk associated with running each type of relay is different.</p>
<p>When a connection is established using Tor, the first two hops are through middle relays. These middle relays help anonymize the the traffic of the user by passing it along to another relay. However, since these relays are not passing traffic into the clearnet, there is very little risk in running a middle relay. The main risk falls upon someone operating an exit relay.</p>
<p>Exit relays act as the source of the traffic, thus when illegal materials are accessed using Tor, the exit relay appears as the source of the request. Exit relays are much harder to operate due to the work required to maintain the relay as it may attract attention from law enforcement agencies.</p>
<p>Bridges are similar to middle relays, however they are not publicly listed as a relay. These relays are important to circumvent censorship tools in countries that restrict access to Tor.</p>
<p>In this guide I will demonstrate how to setup a <strong>middle relay</strong>.</p>
<h1 id="accessing-the-github-student-pack">Accessing the Github Student Pack</h1>
<blockquote>
<p>If you are not a student, you can skip this portion, however you will have to pay to setup the server that the relay operates from.</p>
</blockquote>
<p>Since 2013, Github has provided students with a Student Developer Pack. This amazing program allows for students that sign up for Github with a student email to receive a plethora of free services and software.</p>
<p>All you need to do is navigate to: <a href="https://education.github.com/pack">https://education.github.com/pack</a></p>
<p>Follow the instructions on the site to get access to your free pack. After this, you want to find the DigitalOcean free credit offer.</p>
<p>Copy and redeem the code on DigitalOcean’s billing page after creating an account.</p>
<h1 id="creating-the-droplet">Creating the Droplet</h1>
<p>Once you’ve created your account DigitalOcean will provide you with some options to jumpstart a project. We will ignore this and instead navigate towards the Create Droplet button. You will be taken to a page that provides you with some options for configuring your Droplet.</p>
<blockquote>
<p>Droplets are just what DigitalOcean calls their machines</p>
</blockquote>
<ol>
<li>Name your Droplet</li>
<li>Select the $5/month option</li>
<li>Select the New York #3 Region</li>
<li>Select Debian 10.0 x64 for the Droplet Image</li>
<li>Setup a password or SSH key as the login method (I suggest using an SSH key)</li>
<li>Finish creating the Droplet</li>
</ol>
<p>At this point you should be all done setting up the Droplet!</p>
<h1 id="turning-the-droplet-into-a-tor-relay">Turning the Droplet into a Tor Relay</h1>
<p>The next step is to SSH into the Droplet using an SSH client if you are on Windows or just from the command line if you are using Linux. (Or if you are using WSL then you fall under both categories. I will write another blog post about how to get setup with WSL and all the things I love about it some other time.)</p>
<p>Grab the IP address of the Droplet you’ve just created and try to login as <code>root</code>. If you have created a password, then you should be prompted to enter that. If you are using an SSH key then you should see some messages that ask you to enter Y/N, just enter Y to continue.</p>
<p>Now we will install Tor and Arm onto this server by typing in:</p>
<pre><code>apt-get install tor tor-arm
</code></pre>
<p>It will prompt you again to confirm by entering Y/N, enter Y to continue.</p>
<p>Next we will need to edit some lines in the torrc file, type in:</p>
<pre><code>nano /etc/tor/torrc
</code></pre>
<p>This will open the nano editor which allows you to edit the torrc file. Using arrow keys to scroll up and down in this file until you come across the following lines. These lines will be preceded by the # symbol. You will need to remove the # symbol and edit the lines to match the following input. These lines are not grouped together in the torrc file, however I assure you they are all present.</p>
<pre><code>ORPort 443
Exitpolicy reject *.*
Nickname [Pick a nickname for your relay]
ContactInfo [email at provider dot com]
Log notice file /var/log/tor/notices.log
RelayBandwidthRate 1024 KB
RelayBandwidthBurst 1024 KB
</code></pre><p>Note that the ContactInfo email needs to be obfuscated a little. This is because this email will be publicly listed. Consider making a burner email specifically for this relay as you will not want spam arriving in your daily inbox.</p>
<p>Save and exit the file by pressing Ctrl X then following the prompt at the bottom of the screen.</p>
<p>Next run the command:</p>
<pre><code>service tor restart
</code></pre>
<p>This will save the implement the changes you’ve made to the torrc file.</p>
<p>Finally, run:</p>
<pre><code>sudo -u debian-tor nyx
</code></pre>
<p>If there have been no issues up until now, you should see some nice readouts showing you traffic coming into your brand new Tor relay.</p>
<p>For the first few days your relay will receive reduced traffic due to the network taking some time to trust new relays.</p>
<p>As a final step to ensure the relay is running you can check the <a href="https://metrics.torproject.org/rs.html">list</a> of Tor relays and search for your Tor relay’s nickname to see if it has been listed and check it’s trust status.</p>
<h1 id="closing-notes">Closing notes</h1>
<p>While this guide is mostly beginner friendly, some elements such as setting up SSH keys might not be. I encourage the reader to search a little bit to find out how to configure these things. Most of my work up until now has shown me that almost everything you want to know is out there, you just have to find it.</p>
<p>Big thank you to Robert DeVore’s original article that I based most of this post on. Most of his steps are still perfectly fine, however there were a few things that I wanted to clarify for users which spawned this post (along with the idea that students can essentially host a relay for free).</p>
<p>If there is anything you didn’t understand about this please feel free to contact me.</p>
</div>
</div>
<div class="pagination">
<span class="pagination-item older">Older</span>
<span class="pagination-item newer">Newer</span>
</div>
</div>
</div>
<label for="sidebar-checkbox" class="sidebar-toggle"></label>
</body>
</html>