12/28/20
Biden's 11/4 Early Morning Vote Jump in Michigan (Un-)Explained.
12/20/20
Pennsylvania Election Night Data Irregularity
https://static01.nyt.com/elections-assets/2020/data/api/2020-11-03/precincts/PAGeneralConcatenator-2020-11-04T01:02:56.961Z.json
in Firefox, click "Raw Data", then search for "chester" a few times.
How many more of these half million votes are fraudulent? Most of them are. Again realized this fraud vote dump was too apparent, in #11 at 2:22GMT or 9:22PM EST, they removed a total of 586189 votes! Which votes did they remove? I don't know. But I do know that those fraudulent Chester county votes were not removed. The next Chester vote update wouldn't come until 3 hours later at 5:27GMT (or 0:27 EST).
After #11 huge vote reduction, Biden still hold 200K margin over Trump. From this point on, Trump was able to catch up and leap over. The "glitch" that was caught on CNN where exactly 19958 votes were removed from Trump and added to Biden's total, happened at 4:08GMT (11:08pm EST). As Trump continued gain momentum, at 2am EST in the morning he had a 700K margin over Biden. Then came the big nation wide coordinated "halt", and vote dumps afterward that miraculously narrow the gap. They have everyone's attention.
But I think just like the one in Maricopa county, the huge early Biden head-start in Pennsylvania need more attention. The first 50 vote dumps out of Pennsylvania were complete mess. Some of them got cleaned up, but a good number of fraudulent votes are still there and in the final total. They should be investigated and taken out. The 421:233 Chester votes are still there. The 75K Biden/Trump ratio 16.5 Philly votes are still there. The 73K B/T 8:1 ratio Montgomery votes are still there. The 30K 4:1 Centre votes are still there. If even half of 200K early fraudulent Biden margin is taken out, Trump would win Pennsylvania (Biden's margin is 82K)
5/10/20
Healthy lifestyle and life expectancy
4/10/20
Extracting video from blob url
On a command line(Win, Mac, Linux), type youtube-dl followed by pasting the m3u8 link, then enter.
Of course you should already have youtube-dl installed.
ffmpeg -protocol_whitelist file,http,https,tcp,tls -allowed_extensions ALL -i playlist.m3u8 -bsf:a aac_adtstoasc -c copy out.mp4
4/9/20
Disable ubuntu update manager, timer from command line
On command lines:
sudo systemctl disable apt-daily.timerthen edit 2 files:
sudo systemctl disable apt-daily-upgrade.timer
sudo vi /etc/apt/apt.conf.d/10periodicIn both files, change "1" to "0".
sudo vi /etc/apt/apt.conf.d/20auto-upgrades
4/4/20
Creating Time Lapsed video from dashcam videos
First move all videos into a single folder, then list files and redirect output into a text file. On linux, it's `ls > files.txt`, on Windows, it's `dir /B > files.txt`.
Then edit this file. This file should list videos in the order of timestamp, if not, adjust them manually. Remove any files that's not video or any videos that you don't want to be included in the final video. Put 'file ' at the beginning of every line. (In Vim, you can do this by :%s/^/file /g)
Then create a raw video by select one frame in every 30 frames from all the videos in the file:
ffmpeg -f concat -i files.txt -vf "select=not(mod(n\,30)),setpts=N/(FRAME_RATE*TB)" -vcodec rawvideo -pix_fmt yuv420p -an raw.yuvBecause this is uncompressed raw video, its size will be huge, probably tens of GigBytes. You probably don't want to play it on your computer, let alone uploaded to youtube. To make it playable, we need to compress it to mp4 format:
ffmpeg -f rawvideo -pix_fmt yuv420p -s:v 1920x1080 -i raw.yuv -vcodec libx264 video.mp4You can see an example of the time lapsed video here:
9/3/19
Tornado vs Starlette in 2019
In the last few years, there are several new async web frameworks. One of them is Starlette, I decided to evaluate it. The first step is to compare it basic performance with Tornado.
Starlette, using uvicorn, claims to be one of the fastest python web framework. I copied the codes directly from its website:
I run it with "uvicorn example:app", then measure rps using 'ab':from starlette.responses import PlainTextResponse async def app(scope, receive, send): assert scope['type'] == 'http' response = PlainTextResponse('Hello, world!') await response(scope, receive, send)
ab -n 1000 -c 10 127.0.0.1:8000/The result is on average 4200 requests per second.
I then run basic Tornado app, again with code copied directly from tornado website:
Using the same measurement, the ab result is a average 1900 requests/second.import tornado.ioloop import tornado.web class MainHandler(tornado.web.RequestHandler): def get(self): self.write("Hello, world") def make_app(): return tornado.web.Application([ (r"/", MainHandler), ]) if __name__ == "__main__": app = make_app() app.listen(8888) tornado.ioloop.IOLoop.current().start()
So it looks like Starlette/uvicorn is more than 2 times faster than Tornado. However, the code on Tornado website is actually not the best for production use. Just replace "app.listen(8888)" the second to last line with following:
(and put "from tornado.httpserver import HTTPServer" at the beginning of the file), its performance increases to 4700 requests/second, actually faster than Starlette.server = HTTPServer(app) server.bind(8888) server.start(0)
The code change to Tornado make the app start 4 processes instead of 1. Of course we can also do the similar for the Starlette app:
uvicorn --workers 4 example:appThe result now is 7500 requests/second, surpassing multi-process Tornado again.
These are superficial results that don't mean much. But it did make me appreciate the works that got into Tornado that keep it performant in these years.
Result Summary:
- Tornado (default): 1900 rps
- Startlette/uvicorn (default): 4200 rps
- Tornado (4 workers): 4700 rps
- Starlette/uvicorn (4 workers): 7500 rps
12/19/17
DrJava Font Size Problem
The easy way first.
Click Edit:Preferences, then click "Display Options", change "Look and Feel" to the one that ends with "Plastic3DLookandFeel". Do this on Windows only, for Mac and Linux, default "Look and Feel" is fine.
Click "Font" under "Display Options", change all fonts to double the original size:
Press "OK", then close DrJava then open it again. Now the fonts should be big enough to read.
(The changes you make are actually saved in a configuration file .drjava in your home directory, you can edit the file directly for changes, but it's not recommended)
Now the hard way.
For the "easy way", we just changed DrJava's default configuration preferences. The hard way is to compile a DrJava program with these changes already made in the source code so we don't have to change preferences.
Clone the DrJava repository on github: https://github.com/DrJavaAtRice/drjava
Try to compile it first:
cd drjava/drjava
ant jar
You must have ant already installed. If it's compiled OK, try run it:
java -jar drjava.jar
(You can just double click drjava.jar file too)
Open src/edu/rice/cs/drjava/config/OptionConstants.java for editing:
Change "Monaco-12" to "Monaco-24"; change "Monospaced-12" to "Monospaced-24";
chanage "dialog-10" to "dialog-20"; change "dialog-12" to "dialog-24".
Save the file then recompile (ant jar). Now DrJava is "pre-configured" with big fonts.
You might say this "hard way" is pointless. Why on earth would anyone want to do this? I agree. But just maybe one wants to provide a "pre-configured" copy of DrJava to his students. I just show one way to do it. Another way is to write a .drjava configuration file upon installation. This is way more complex. Besides, I'm using a standalone jar file, there's no installation to speak of.
7/18/15
Bugzilla "Cannot determine local time zone" problem
Below is the only fix that worked for me:
In 'lib/DateTime/TimeZone/Local.pm', find 'sub TimeZone {', right after it, put this next line:
return DateTime::TimeZone->new(name => 'Asia/Shanghai');(Replace 'Asia/Shanghai' with your own timezone.)
Basically all the rest of this sub has no effect now.
Reload the error page, if it show another error says: "List::Util version 1.31 required...", open 'lib/List/AllUtils.pm', goto line 10, or find the line:
use List::Util 1.31 ();Just delete '1.31'.
After that, it should work. I'm using Bugzilla 4.4.9.
6/5/15
Cloning HDD to a smaller SSD for a Windows 8 Laptop
I formatted the SSD to a GPT disk, then use various cloning softwares to do the cloning. I tried Macrium Reflect Free, EaseUS Partition Master, Minitool Partition Wizard. None of them get me to Windows startup screen.
The last one I used is Minitool Partition Wizard. During boot, it said can't find OS. So I tried changing different bios settings out of desperation and hoped one would work. It did.
The setting is "disable virtualization". I don't know why it worked, it doesn't make any sense, I'm just glad it did.
So if you have problem migrating HDD to SSD, this might be something you can try.