jethrokuan / braindump Goto Github PK
View Code? Open in Web Editor NEWknowledge repository managed with org-mode and org-roam.
Home Page: https://braindump.jethro.dev/
knowledge repository managed with org-mode and org-roam.
Home Page: https://braindump.jethro.dev/
Locks are used for mutual exclusion. When you want to ensure that a piece of code is atomic, put a lock around it. You could theoretically use a binary semaphore to do this, but that's a special case.
Semaphores and condition variables build on top of the mutual exclusion provide by locks and are used for providing synchronized access to shared resources. They can be used for similar purposes.
A condition variable is generally used to avoid busy waiting (looping repeatedly while checking a condition) while waiting for a resource to become available. For instance, if you have a thread (or multiple threads) that can't continue onward until a queue is empty, the busy waiting approach would be to just doing something like:
//pseudocode
while(!queue.empty())
{
sleep(1);
}
The problem with this is that you're wasting processor time by having this thread repeatedly check the condition. Why not instead have a synchronization variable that can be signaled to tell the thread that the resource is available?
//pseudocode
syncVar.lock.acquire();
while(!queue.empty())
{
syncVar.wait();
}
//do stuff with queue
syncVar.lock.release();
Presumably, you'll have a thread somewhere else that is pulling things out of the queue. When the queue is empty, it can call syncVar.signal() to wake up a random thread that is sitting asleep on syncVar.wait() (or there's usually also a signalAll() or broadcast() method to wake up all the threads that are waiting).
I generally use synchronization variables like this when I have one or more threads waiting on a single particular condition (e.g. for the queue to be empty).
Semaphores can be used similarly, but I think they're better used when you have a shared resource that can be available and unavailable based on some integer number of available things. Semaphores are good for producer/consumer situations where producers are allocating resources and consumers are consuming them.
Think about if you had a soda vending machine. There's only one soda machine and it's a shared resource. You have one thread that's a vendor (producer) who is responsible for keeping the machine stocked and N threads that are buyers (consumers) who want to get sodas out of the machine. The number of sodas in the machine is the integer value that will drive our semaphore.
Every buyer (consumer) thread that comes to the soda machine calls the semaphore down() method to take a soda. This will grab a soda from the machine and decrement the count of available sodas by 1. If there are sodas available, the code will just keep running past the down() statement without a problem. If no sodas are available, the thread will sleep here waiting to be notified of when soda is made available again (when there are more sodas in the machine).
The vendor (producer) thread would essentially be waiting for the soda machine to be empty. The vendor gets notified when the last soda is taken from the machine (and one or more consumers are potentially waiting to get sodas out). The vendor would restock the soda machine with the semaphore up() method, the available number of sodas would be incremented each time and thereby the waiting consumer threads would get notified that more soda is available.
The wait() and signal() methods of a synchronization variable tend to be hidden within the down() and up() operations of the semaphore.
Certainly there's overlap between the two choices. There are many scenarios where a semaphore or a condition variable (or set of condition variables) could both serve your purposes. Both semaphores and condition variables are associated with a lock object that they use to maintain mutual exclusion, but then they provide extra functionality on top of the lock for synchronizing thread execution. It's mostly up to you to figure out which one makes the most sense for your situation.
That's not necessarily the most technical description, but that's how it makes sense in my head.
I really love this setup, especially from org-roam to a beautiful hugo website. Is it possible for you to share the relevant files and setup so that others can replicate it? Additionally, is there a way to mark which files or perhaps a subfolder of files in the org-roam directory that would be exported (say if one wanted some files not to be exported)? Thank you in advance!!!
I have a suggestion. The Full Index page opens on the left most pane. But when I click and topic in it, the topic replaces the Full Index page.
Instead, will it be possible to open these topics on the right side pane, just like any other internal link on your pages. It helps keep the full index page always accessible.
Also, how are the topics in the full index page arranged? According to their date of creation? Normally topics in index pages are arranged alphabetically.
Real congrats on your material. My question is simple: how to generate a website like https://braindump.jethro.dev/ for browsing one's notes? Thanks!
I really like the your braindump website, looks great and very useful.
I tried to mimic it but one thing I didn't figure out is how are the backlinks in the markdown files are generated? I think ox-hugo doesn't add that in my case.
For eg, books.md has something likes this:
## Backlinks {#backlinks}
- [How To Take Smart Notes]({{< relref "how_to_take_smart_notes" >}})
Thanks a lot for your work!!
Hugo is an SSG. I was wondering how did you integrate search on Hugo? Are you using something like Algolio?
Hi @jethrokuan thank you for all your hardwork on org-roam. I have a similar setup to you for exporting to hugo, I'm curious if you know why some references generate this NO_ITEM_DATA , for example:
Do you know why this happens and what the fix is?
Thank you!
Hi Jethro,
I'm trying to build my own theme but I cannot seem to get the bibliography to appear as neatly as you did. I also noticed in the org files that you do not have #+print_bibliography
. So I was wondering how you got this to work
Dependabot couldn't find a package.json for this project.
Dependabot requires a package.json to evaluate your project's current JavaScript dependencies. It had expected to find one at the path: /package.json
.
If this isn't a JavaScript project, or if it is a library, you may wish to disable updates for it from within Dependabot.
Hi,
I'm very happy using org-roam. Now I'm trying to make public my notes. But I really don't know how to make the automatic export of my orgfiles in my Dropbox folder to my content file.
Can you explain me the process?
thanks
Hello @jethrokuan,
Good day to you.
I saw your build.py based on your ~/.emacs.d/init.el
Could you share your init.el?
I am using Doom Emacs, I found ninja run emacs could NOT point to my Doom Configuration.
I guess this is reason why you are using init.el.
Have a nice day,
Boyang Yan
Hi, first of all,thanks for posting your braindump (and org roam, it's really a great tool) .
Second, it's not really a "real issue", but I'm a bit confused and I think this will help other people too: I can't get Ninja to work with this repo.
I summarize: I downloaded the repository, I make a ./build.py. The output: ninja: no work to do. Perfect!
git submodule init
git submodule update
Yhea easy
And finally :
hugo server
Ok perfect !
Now I want to modify files, and it comes with several problems.
When I modify a file, I do a ./build.py, and I get the following output: ninja: no work to do. Hum, strange
First problem.
I look at build.py, and I spend A LOT of time to except find the problem.
And I can't find any solutions.
I have a clue: when I modify the files to be taken in ./build.py, the conversion starts and... never ends. YES. Second problem
No matter how hard I look at the problem, I can't do anything about it, but above all: I don't have any leads left to look for (I haven't managed to see the solution).
Thank you in advance for your future answers
Incorrect documentation at the end of README.md
hugo serve
Instead of
hugo server
NIX need lot of space and hand calibration on Mac. It won't be easy to do that since i am low on disk volume. Could you please suggest other then nix way to install your package ??
What i want is :
[entropy]({{< relref "2021-03-06--03-56-06Z--entropy" >}}
But, I get this on using org id :
[entropy](2021-05-29--04-28-46Z--entropy.md)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.