Skip to content

Instantly share code, notes, and snippets.

View JCharante's full-sized avatar
:shipit:
sleeping

Jyan JCharante

:shipit:
sleeping
View GitHub Profile

It would be cool if someone would make a simple site like hitcounter.org which you could embed in any document with <img src="https://hitcounter.org" referrerpolicy="origin"/> and it would use the http referrer header to identify the site & return the corresponding number of lifetime visits for that site/page as an image. It wouldn't need JS like existing options so you could embed it in github gists.

Anki: Chinese Card Templates

This is not a card deck, but is how to style your cards so they look nice. I will show you screenshots so you know where to paste and I will include the code as text.

I should note that this card type was originally downloaded from an HSK deck, but through 2 years of constant use changes the way I use the cards. As such there are many fields I don't use and I don't take credit for the design.

Recall: meaning

What are Collision Cards?

Every time you mix up 2 words for each other, you create a collision card. This ensures you practice against making that mistake again.

This is useful for glyph languages like Chinese or languages with tones where you might visually confuse words.

Here is an example of a Vietnamese cloze card (go to next section for Chinese examples)

Front

@JCharante
JCharante / race.md
Last active December 2, 2023 12:39

A Leetcode Race

My old roommate and close friend of mine, Mike, has been better than me at math and didn't mind doing leetcode, while I've always hated it (until now). I didn't really give leetcode a try, but hearing about memorizing different algorithms sounded really boring. Well, this month I gave it a try and turns out it's really fun. I love solving the problems and I always check afterwards to see how I can improve/optimize my solution, and when I face a challenging problem I love the feeling when all my test cases pass.

Anyways, this month I was at rank #2,500,000 (not contest rank, just from async problem submissions), but now I just cracked #400,000.

Around 5-6 years ago, I was working in a small team on IoT devices and found out that the new fancy cars with continous tire pressure monitoring were broadcasting data to the car's computer wirelessly with persistent identifiers. I wondered if with enough sensors spread out, you could use this to create traffic maps for the city, or try tracking people (you could simply sit next to a grocery store exit, measure the strongest tire signal, and write down the license plate, or you could use an automated license plate reader to do it for you).

I wonder if there's a company that has tried taking advantage of this? I remember an open source license plate reader system for a community that had a problem with package thieves and Waze users (so they wanted to log every vehicle driving through their neighborhood). but I think they got told to stop using it by their city for privacy reasons?

@JCharante
JCharante / why-why-why.md
Created October 13, 2023 08:51
JS is crazy

Why JS oh WHYYYY

I just realized you can do this and it's totally error free

let c = []
c[2] = 2
console.log(c) // [null, null, 2]

Leetcode SQL is fun! Have you ever made something so terrible that you want to share it?

I normally hate leetcode, but for fun I took a look at the Database problems where you use SQL and it's really fun because I feel limited by SQL so the problems are more about wrestling SQL rather than wrestling some algorithm that I have to recall or re-invent from scratch.

When I see a new problem, there's usually some silly approach where I can abuse CASE to solve it, but then it's really fun to find a solution and then see how other people did it, it's a great way to learn. I'm not new to programming, but I am new to trying to do everything in SQL without the application layer helping out.

Did you know about the Having clause? https://www.w3schools.com/sql/sql_having.asp

I come from a lifetime of having been indoctrinated by ORMs so I didn't know about this keyword, but recently I've been doing some SQL leetcode to pass the time and wow, that clause is useful.

(My solution was to use a sub-query which I learned about last week and I later saw that other solutions used HAVING. In fairness my naive solution was still faster than 98% of submitters, which is a bit shocking)

Yesterday I found an amazing chrome extension. If you've used the ios app for chatgpt, then you'll know there is a speech-to-text feature that uses whisper (I assume it's whisper, but it's definitely not the ios keyboard speec-to-text). Whisper is speech-to-text model built by OpenAI, and it is really great (there are still some faults, it has a hard time distinguishing V and B when spelling out words, but that might be my own fault?). Anyways, this chrome extension lets you enter an api key, and then it adds a button to let you talk into the textbox using the whisper api. I'm a bit cautious of chrome extensions due to how easy it is for them to turn into malware, but this extension is so great.

Something missing from the ios app is the ability to talk multiple times. In the ios app, after you talk, you can't press the mic button again, you just have to send. However with this plugin you can create a very long message by talking multiple times per message.

Recently I've been working on a python repo with a data directory, so even though I use version control, because of the data (which is not included in the repo) I've just been compressing the directory and copying the .zip to my icloud drive, and then uncompressing it on my other computer. As a mostly React developer, I've realized how freeing this is. Normally you can't copy over project files into an archive without being careful to exclude the node_modules folder, because if you accidentally include it then it takes forever to create the archive due to the huge amount of files. I forgot that the python system is so free. Now, if I had a .venv or .env folder due to using a per-project virtualenv, then I'd have to be careful about excluding that, but I'm been mainly sticking to the standard lib so I haven't needed that.