932 karma · joined Sep 18, 2020 (6y ago) · 485 submissions
comment 4y ago · link · parent
(off-topic) It made me realize how many languages Gboard supports. I saw Bench and laughed (because I thought of benches speaking) but then learned it's a real language with 300k fluent. I was then disappointed that very uncommon languages are supported while Bavarian (over 10 million speakers) seemed to be missing.
It *does* exist under Austro-Bavarian.
Tested it, and it recognizes each word in and suggests completions for phrases like, "ned gschimpft isch globt gnua," words like, "jednfois," etc.
comment 4y ago · link · parent
https://github.com/numpy/numpy/issues/10161#issuecomment-350...
plus a ton of flogging/benchmarking common libraries (numpy, scipy, scikit-learn) and discussion about np.isclose()
... and also this gem:
import numpy as np
a = 1
b = 10
rtol = 1
atol = 0
np.isclose(a, b, rtol=rtol, atol=atol) # True
np.isclose(b, a, rtol=rtol, atol=atol) # False
(For the record:) import math
math.isclose(a, b, rel_tol=rtol, abs_tol=atol) # True
math.isclose(b, a, rel_tol=rtol, abs_tol=atol) # Truecomment 4y ago · link · parent
France has the special property of zooming out to the entire world map because there are multiple French territories located around the Caribbean islands. (Do French people have maps like the U.S.---where Alaska and Hawaii are an inset beside the contiguous states---that show all of the various French islands?)
-----
Two recommendations for improvement that unfortunately make a non-trivial amount of work:
* consistent localization (so many choices: all English names, all local names, local names for non-Latin alphabets, all English and local names with redirects, etc.);
* having true "find by location", because if you search for Saint Barthelemy, you get every listing from France.
* (bonus) test spell check results of "not found" locations. If I search Saint Bartholemy on the piano finder, the result is "No place found", while on Google Maps, it shows Saint Barthélemy.
comment 4y ago · link · parent
No idea for purely circuit theory. My textbooks were not great, but videos from 6.002 (a course at MIT) were a godsend.
Sedra/Smith is my recommendation for applied circuits. It's mostly amplifiers---still with a heavy emphasis on theory. At 1400 pages, it's really, really long. (A good portion of this is also taught in 6.002.)
The Art of Electronics is a gold mine of knowledge but very, very in-depth/technical. By chapter 4, you're analyzing a precision waveform generator with 3 ICs, a MOSFET, and a handful of passive components for biasing/filtering. Horowitz/Hill even recommend specific components (lots of tables) with explanations, and they point out some common circuit mistakes, workarounds, and improvements. Also, it's over 1,000 pages just in the main book. If I had to pick one book as the sole resource for an EE degree, it's this one.
As a supplement to books: Falstad's circuit simulator[1] because it is very easy to use (compared to SPICE) and has examples of nearly every circuit you would learn as an undergrad.
comment 4y ago · link · parent
Also: https://humansofuniversity.com/university-life/top-50-colleg...
comment 4y ago · link · parent
1. focused on the 'big picture' too much
2. focused on the wrong things
3. didn't spend enough time on culture from day one
4. didn't quit my 'day job' fast enough
5. drank my own Kool-Aid
6. underestimated the time it would take to raise money
7. listened to the tech press
8. focused too much on competition
9. didn't learn from competition
10. didn't communicate
... plus 59 other slidescomment 4y ago · link · parent
Then again, is it wise to install liquid metal on an unstable vessel surrounded by water?
[1] https://electrek.co/2021/08/25/worlds-first-autonomous-7mwh-...
[2] https://www.advancedsciencenews.com/getting-a-charge-out-of-...
[3] https://www.greentechmedia.com/articles/read/slideshow-updat...
comment 4y ago · link · parent
The answers to, "Why did Will Smith slap Chris Rock?" will be much different five seconds after the event compared to five days after. Of course you would expect the Academy Awards to be part of the answer five days later, because practically every news article would mention the venue.
Going even further, a simple (undergrad-level) language model would detect the nominative and accusative, so you might even get a correction as an answer if you ask, "Why did Chris Rock slap Will Smith?"
Seven thousand people might ask this same question, while nobody wonders what the best rugby ball chili recipe is. GPT-3 will never try to organically link those ideas unless people start asking!
I'd even venture that negative follow-up feedback is factored in. If your first reaction to an answer is, "That was WRONG, idiot!" this is useful info!
Then again, if a negative feedback function exists, adding a human to the loop should be simple (and effective).
-----
Is 40 a weak army? It depends on whether they are classifying questions randomly/sequentially or if they hammer away at the weakest points... grading Q/A pairs (pass/fail) based on a mix of high question importance and strong uncertainty of the answer.
comment 4y ago · link · parent
And so on, while the rest of the food is burning/sticking/melting.
Plus, a "stick" of butter is not sold in Germany. What they have is more than two sticks joined side-by-side.
comment 4y ago · link · parent
comment 4y ago · link · parent
If I put any of the example code into a file and run g++ test.cpp -o test -std=c++2a, I get the very expected error, undefined reference to 'main'. Adding main isn't going to magically make a struct turn into a UI. There are no #include statements. It's clear a library is needed as well as some familiarization.
Midway through, a link to Nuklear is provided. At the very bottom, the reader learns this can be tested with the avendish library... a bit after the sentence stating, "Glory to the post-library era."
I still don't know whether the code uses Nuklear or avendish or both, and because there will be more than a few steps to install and this solves a problem I don't have, I lost interest in the examples and will continue to ncurses my way through GUI MVPs.
comment 4y ago · link · parent
https://github.com/journal-doi/cough
https://github.com/the-pudding/cough
https://github.com/arp242/goatcounter (bonus material)
comment 4y ago · link · parent
The fourth pin, Vcap, would be frustrating, because using two vias to place a capacitor on the opposite side of the IC is labor-intensive, and using two vias to place a capacitor beside the IC is a bit of an unnecessarily long signal path for a filtering component. I'd rather gouge a hole and solder a capacitor directly onto the IC between Vcc and Vcap, but "gouge a blind hole in the dielectric and solder an 01005 capacitor to the IC" is not a commercially viable answer either.
Maybe pray your design doesn't need Vcap or that this can be tied to GND?
comment 4y ago · link · parent
One work project of mine involved a bunch of sensors, an 8-bit microcontroller without much memory, and an SD card. It turns out that cost, brand name, and speed class have nothing to do with AU boundary latency. Trying to write 255 bytes every 2 to 10 milliseconds at a few MHz on a chip with 2.5 KB SRAM, the limiting factor is the SD controller needing up to a hundred milliseconds every 10 seconds or so (depending on AU size) during which real-time data cannot be buffered in the SD card, microcontroller, or sensor FIFO. There's simply too much data waiting to store!
-----
A few notes for anyone at all who cares:
Single-level cell (aka industrial) SD didn't result in a faster AU change speed.
One SD card---out of 10 or 12 tried---would not pull down its MISO line unless an extra clock pulse was manually bit-banged, which is a really stupid behavior to debug after having a few working cards. Tracking down this bug took a lot of garbled data, scope measurements, and re-readings of the SD specification to see if my code was wrong or the card manufacturer was non-compliant.
The specification has a maximum write latency of something like 200 ms, and that's the sort of detail you miss until you've spent time and money designing/ordering a PCB and realizing you should've just added a 64Mbit flash IC and dealt with the inconvenience of UART data transfer.
comment 4y ago · link · parent
The first line of defense is unaliasing sudo and calling sudo -k at the end of the function, but someone could probably just replace these lines with a sudo() function that has the same behavior, same output, and just tees my password into /tmp where it can be accessed later.
Then, I added one of the popular Linux malware checkers that sees if any system binaries or user-specified files have been modified and run that silently during the update script. By virtue of the malware checker being popular, I would guess anyone skilled enough to be remotely accessing my shell would know what that program does and run the commands to update its configuration so all their changes look normal.
Adding a layer of protection, I have a script in another runcom that---on a local shell---just compares md5sum of the malware checker and the other runcom and echoes a line to check those files if the checksum doesn't match.
Again, someone can look at all the hidden files in $HOME and see this md5sum check exists. I'm not verifying this file every day, and I don't memorize the hashes, so I wouldn't even be able to verify this file the way it is written.
There's probably a good way to guard against 99% of unauthorized access (e.g. non-state-level) like chmod 0400 .shellrc and manually running the update commands with the prefix disabling aliases (and also not leaving these commands in the command history either).
On the one hand, this is so much trouble. I have no evidence that nefarious access to my computer has ever occurred. On the other hand, would I have evidence that access has occurred if my system isn't hardened better?
-----
In my fantasy world, I'd have a non-erasable/non-bypassible physical device + Linux module that MUST be part of the communication path before a shell can be accessed. This could be a dual-pole relay where one pole physically connects the incoming traffic while the other pole rings a loud bell. An alternative would be a receipt printer that prints the login time, user, IP, etc. and then allows access to the shell.
A dedicated attacker could then just replace my keyboard or peer through my window with a telescope from a nearby building or tape a small webcam in the corner of my window where I wouldn't notice. Or send an email from a close-but-not-exact address of a colleague and call with a raspy, obviously sick voice imitating said colleague, saying "hey, I'm doing home office today because I'm sick, can you log into the server room with the link I sent you, I'm on the other line with a customer. He's pretty pissed!"
Day's end, the company needs to hire a person/team to ensure security if it's so important. I will try to do my part to keep company secrets within the company, but I'm not building the entire castle to protect my little workshop.
(The other advantage is that I genuinely don't believe our competitors would benefit from having our source code, and our significant customers aren't likely to purchase knockoff products. Much more important? Protecting our business and customer data.)
-----
Unless we're building ENIAC ourselves with spools of wire and magnets, building our own keyboard or input device, manually typing in the source for the compiler... (Even then, if you haven't drawn the wire yourself, can you really trust it hasn't been tampered with somehow??)
You have to accept some degree of trust in the hardware, firmware, software, and meatware that you employ while accepting some degree of risk.
-----
One aspect of this repo that bothers me is the raw file, Compiler. This file plus the theme of this project? There's no way I'm cloning and compiling this. I realize I can load this Mach-O executable into Ghidra and figure out if it has a broader purpose than "proof of concept", but then I'm trusting that Ghidra doesn't telemeter my data directly to a server in Fort Meade... See how stressful this zero trust model can be??
comment 4y ago · link · parent
https://gist.github.com/koral--/12a6cdda22ffbd82f28ecc93e0b5...
comment 4y ago · link · parent
What worked for me initially was the POSIX write() function:
#include <stdlib.h>
#include <unistd.h>
int main(void)
{
int status;
status = write(1, "Hello World!\n", 13);
if (status < 0) { return EXIT_FAILURE; }
return EXIT_SUCCESS;
}
-----As someone else commented, fflush() gives the desired error response.
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
int status;
puts("Hello World!");
status = fflush(stdout);
if (status < 0) { return EXIT_FAILURE; }
return EXIT_SUCCESS;
}
-----andreyv probably has the best alternative[1], which is checking fflush() and ferror() at the program's end and calling perror(). It's better because it outputs an actual error message on the current terminal, and you don't need to write a special error checking wrapper.
comment 4y ago · link · parent
You'd have to know each octave doubles in frequency.
Side quest: When you play the bugle, the played frequency increases or decreases by MULTIPLES of the base frequency---NOT powers of 2. Suppose this base frequency is 250 Hz. There is an octave from 250 to 500, but there's a note between the octave from 500 to 1000 at 750 Hz, and a few notes between 1000 and 2000 Hz, which is the part of the musical scale something like Reveille is played. If Reveille jumped from octave to octave, it would just sound like the intro to Justin Hawkin's cover of This Town Ain't Big Enough.
So, if you know transformer hum is 50 or 60 Hz and Queen's frontman starts his singing at 100 Hz, then he can sing up to 1600 Hz, or four octaves. Mentally recalling what his falsetto sounds like, you can imagine a really high-pitched guitar solo an octave above this, and you can still imagine what an octave above that would sound like. (Maybe you're getting close to dog whistle territory in your imagination.)
This, then, is 6400 Hz you are imagining. The top of each sound wave to the top of the next is 6400 Hz. To record this, you'd need the top AND bottom of each sound wave, because the speaker cone moving from maximum to minimum displacement is how the sound is made. If you want to make sure you aren't accidentally recording the middle (zero crossing) of each wave, you can even take three or four or five samples per sound wave instead of two. It's a lot of thought, but you can reasonably decide that 25000 Hz is a good sampling rate for capturing much of the range of human hearing. Going too far beyond that, you're wasting storage space.
A CD holds a bit more than an hour of music, or 3600 seconds. If you've listened to Dire Straits, Eagles, Cyndi Lauper, Metallica, David Bowie, Led Zeppelin, ELP, or nearly any other band, you're probably aware the recordings have independent left and right channels.
Finally, each sample is going to be somewhere between "speaker fully retracted" and "speaker fully extended". With 5 bits, this gives 16 "stops" from the middle point to fully extended. But we know that music can get really quiet when it fades out, and a lot of volume knobs can go from zero to thirty and sometimes higher. When you have the volume at one, you can still tell the difference between loud parts and quiet parts, so you'd need an extra 5 bits just to get good dynamic range at loudest and quietest volume settings, or 10 bits. What happens when you double this? If you have 20 bits, you are probably close to wasting bits. You have a million places where the speaker coils can move to. For a speaker that moves a few millimeters, this means 20-bit resolution allows steps of a few nanometers. This is the scale of computer chips and color wavelengths. If you took the color blue and shifted its wavelength by a few nanometers, it would still be practically the same shade of blue! Without knowing about bit depth, you can reasonably assume 16 bits is good because it's a power of two and will give a lot of dynamic range. 8 would be too low. 32 is just wasteful.
With 32 bits, a speaker capable of moving 1 cm end-to-end will have 10 carbon atom diameters of linear resolution. The ears are impressive, but I don't know they can differentiate the air displacement of (speaker cone area) x (ten carbon atoms). Even having 0 to 100 on the volume knob, this leaves 25 bits of range at each volume setting. This is audiophile (and arguably, snake oil) territory.
So then, you can say 3600 seconds is pretty close to 3000 seconds, 2 channels is close to 3, 16 bits is close to 10, 25000 Hz is close to 30000 Hz... 3 x 3 x 3 x 10 x 1000 x 10000 ≈ 3,000,000,000. Since a byte has about 10 bits, divide by ten, and this yields a first approximation---based on logic reasoning of what we know---of 300 MB. It's wrong, but it's not "very" wrong. (It's off by a factor of two, not a factor of ten! Not bad for 4 rounded, intermediate conversion terms...)
(The idea is to round each term to a value starting with 1 or 3, because multiplying 3 and 3 is close to 10. The reason 2 is close to 3: 10^(1/2) = 3.16. This states that a good midpoint of 1 and 10 is 3.16, because if you square each term, you get: 1, 10, 100. Now, 10^(1/4) = 1.78. This means that any value less than 1.78 would be closer to 1 after squaring, and any value higher will be closer to 10.)
You can even take the analysis further and back-calculate things like how fast the CD might spin by guessing the track width and bit area, how long a track skip would be, whether the size limitation of the CD is due to optical or material properties, how far the laser would need to be to converge at one bit while being close enough that any deviation in the surface flatness doesn't send the return beam away from the sensor, etc. (This is all the info you'd probably use to begin the approximation if you weren't aware an audio CD holds an hour of music, like if you were asked in 1975 to "back of envelope" whether a compact, non-contact, vinyl-like, LP-length recording medium was possible.)
comment 4y ago · link · parent
It's still a bit much to absorb, but you can't really ever say the author didn't attempt to describe each lesson in real world terms. You memorize or learn to graphically/logically derive a few things, like how log(1+x)≈x for small x or how you can sorta guess for most quantities or plots. (One book example figures the data capacity of a CD if you know its music storage using informed guessing of each conversion factor from seconds of music to bits.)
As another example: powers of cos x from -pi/2 to pi/2... you can sketch cos x and then roughly sketch the second power, and then it's clear that the more times you do that, you get a bit more of a bell curve. One in the middle will always stay one in the middle, but you get less area with each iteration as the rest of the function approaches zero. If you wanted an integral, you eyeball where the plot is at 0.5, draw a full-height rectangle from the left 0.5 value and the right 0.5 value. Because the height is 1, the width is pretty close to the true area. You can decide at this point---if you want more precision---to visually guess if the tails or the main part of the function should have more area and adjust your answer.
There's an Open Access PDF at https://mitpress.mit.edu/books/street-fighting-mathematics
There were lecture videos on MIT's Open Learning Library (and somewhere else before that), but they're currently down.
The class site is https://ocw.mit.edu/courses/mathematics/18-098-street-fighti... as well as http://web.mit.edu/18.098/
comment 4y ago · link · parent
The alternative? Take them out and enjoy the rich, sonorous, ever-so-slow hearing loss!