Posts

Showing posts with the label code

The Ralph Wiggum technique

I came across this technique when reading this wall street journal article -   Our AI Future Is Already Here, It’s Just Not Evenly Distributed .   "Ralph is a Bash loop" The Ralph Wiggum technique is an iterative AI development methodology. In its purest form, it's a simple while loop that repeatedly feeds an AI agent a prompt until completion. Named after The Simpsons character, it embodies the philosophy of persistent iteration despite setbacks.   - Source: awesomeclaude 

.desktop files on Ubuntu

It took me a whole hour to figure how to set up a .desktop file on Ubuntu which honestly seems unnecessarily complicated. In previous versions of Ubuntu, there was a GUI (gnome-desktop-item-edit) which aided in this process but unfortunately, this appears to have been removed. Here are some useful notes to set up .desktop files .desktop file format example #!/usr/bin/env xdg-open [Desktop Entry] Version=1.0 Type=Application Terminal=false Exec=/usr/bin/gedit %U Name=Test_1 Comment=comment here Icon= What's the %U in the Exec file? It's a parameter for the Exec key in .desktop files (defined in the Desktop Entry Specification) that describes how arguments to the program (from the file manager/program launcher, e.g. multiple selected files) should be handled Make the desktop file executable and copy it to /.local/share/applications Launching the file from the terminal gtk-launch something.desktop  

Spiral Galaxy Rotation Curve Builder

Image
 A great tool to understand galaxy rotation curves : https://wittman.physics.ucdavis.edu/Animations/RotationCurve/index.html      

Giving up on PDF annotations

What I wanted: To be able to seamlessly take notes on PDFs with the annotations automatically synced to my notes. Additionally, if I make any changes to any of the annotations at any time, they must also immediately sync back to my notes.  Is this possible?: Note that this workflow for HTML is possible using WebResearcherJS (https://github.com/kvgc/WebResearcherJS-extension) along with Joplin.  However, after exploring this issue for a considerable period of time, today, I give up on my pursuit to integrate PDF annotations directly with my research workflow. I am prepared to label this task as 'possible but time-consuming and challenging to implement'. Solution adopted: Instead, the solution I adapted was to iframe the pdf on to a webpage and use WebResearcherJS to take notes on the webpage. Thus far, this pipeline works like a charm and eliminates the need to directly deal with PDFs. Notes: Python: I wrote a python module that extracts PDF annotations . One possibility is...

beautifyPlot: A simple matplotlib wrapper to avoid writing ‘plt.’ statements on many lines

I made a wrapper to avoid writing ‘plt.’ statements on many lines. This method also lets me save the arguments passed to matplotlib in a file for later use. GitHub repo: https://github.com/kvgc/beautifyPlot Example: matplotlib code: import numpy as np import matplotlib . pyplot as plt x = np . arange ( 0 , 100 , 1 ) y = x ** 3 plt . plot ( x , y , label = 'y=f(x)' ) plt . title ( "test plot" ) plt . xlim ([ 0 , 10 ]) plt . ylim ([ 0 , 1000 ]) plt . legend ( fontsize = 15 ) plt . tight_layout ()   Using beautifyPlot module: from beautifyPlot . bplt import beautifyPlot import numpy as np x = np . arange ( 0 , 100 , 1 ) y = x ** 3 plt . plot ( x , y , label = 'y=f(x)' ) plotArgs = { 'title' : [ 'test plot' ], ## Use list to pass a set of arguments to the function 'xlim' : [ 0 , 10 ], 'ylim' : [ 0 , 1000 ], 'legend' : { ...