Pascal Bakker

HomeLinksProjectsResume

Sudo is Blooaat!!

2021-02-15

linux, programming


Bloat Bloat Bloat

Just use Doas if you are running a system on a simple PC/laptop. Sudo is complete bloat(and may have vulnerabilities) unless you plan on doing some sort of network administration. This is all you have to do to setup your doas privileges on your computer.

  1. Install it.
  2. Open /etc/doas.conf
  3. permit [user] as root
Then you're done.

Original video.

How To Setup MOCP Terminal Music Player

2021-02-15

linux, programming


Why use a terminal based music player?

GUI music applications can often be slow, difficult to navigate, and bloated. Terminal based music players offer simplicity: just play the music. Although, simplicity!=easy, it may get some time to setup and to get used to it. However, due to their minimalist design, they are often easily configurable and customizable. GUI based music players require to move your mouse around searching for the right song to click, breaking your flow. But with terminal-based players, everything can be done with a keyboard. I was a skeptic at first, but now I don't really want to go back to GUI. I enjoy moc in particular, it has a nice look to it, and the keyboard commands are intuitive.

This tutorial will go over how to setup moc after you install it

First, run the following commands after installation.

	cp /usr/share/doc/moc/config.example ~/.moc/config
	mkdir ~/.config/mocp/themes
	/usr/share/doc/moc/themes/[Desired Theme] ~/.config/mocp/themes

Copy the example config file and desired theme to the moc folder. Then go into config, set the following settings:

	MusicDir: ~/music

	StartInMusicDir = yes

	Theme = nightly_theme

Now for mocicon. Do not download the code from github since its out of date. Instead, get it from sourceforge. If your terminal is not xterm, you must change the mocicon code. Go into mocicon.c and change xterm to your desired terminal.

	case 6:
		g_spawn_command_line_async("xterm -C mocp",NULL);
		break;

Since mine is st...

	case 6:
		g_spawn_command_line_async("st -C mocp",NULL);
		break;

After you're down, just compile:

	sudo make clean install

Now just check that it works:

	mocp

The music icon should show up in your bar. And you're done! Now you can enjoy your terminal music browsing experience.

Final Semester of College

2021-01-27

life


My final last semester of college. Over break I prepared my resume and stated applying for jobs.

List of spring classes:

  1. Graduate Qualifying Project
  2. Information Retrieval
  3. Data Analytics

Overall, I did learn quite a bit from my Master's program. However, some classes were excruciating unpleasant and not particularly useful. These tended to be the one's I was required to take first year. For example, my first semester database class really just went over stuff I already knew about SQL. And my statistic class went over subjects they taught in undergrad(and AP stats). However, some of the better classes tended to be more math heavy, such as Deep Learning and Reinforcement Learning. These classes are what made my Masters worth it. One of the most critical aspects of college was the free time to explore subjects in depth. I feel immensely more confident in my abilities in programming and software development than I did at the start of my program.

Updating My Website

2020-11-22

update


I cleaned up pascalbakker.xyz to remove all images. This should make my website look nicer. The web is already filled with bloated websites with unnecessary images and animations. Plus now the experience between GUI web browsing and console-based browsing is uniform.

Tinkering and Coding

2020-11-22

scala, programming, update, technology


I am getting into suckless tools. In the past I used st, but I just used a patched version I found on GitHub. I am now obsessed with configuring suckless builds myself. Right now, I'm configuring my surf browser. I honestly like it. The only downside of surf is that it doesn't have an AdBlock. Hopefully that will change one day... Once I'm done tinkering with surf I'll try out dwm. I also now also use mocp, a console based music player(emphasis on based), and neomutt for mail. Overall, I'm primarily moving towards using entirely terminal based applications because im a linux hipster(btw I use arch).

If you can't tell, I'm going through a minimalist software phase. The benefits of using minimalist software, besides being low in memory usage, is an extreme amount of control over the functionality of the software I use. Its kindof a physcological thing, I feel in control when I use it.

I'm also studying up on functional programming in scala and using Akka. The Scala language interests me greatly, due to its access to Apache software and ability to combine imperative, object oriented, and functional programming all together. Pure functional programming for me is too hard, so I like the ability to write 'normal' Java where neadby, and use functional programming whereever useful. I also have to use Scala for my final project in Big Data

Thats all for now

Preview Images and Pdfs in Ranger

2020-11-17

technology, linux


To enable pdf image previews in ranger. Uncomment the following line in ./config/ranger/scope.sh

application/pdf)
		 pdftoppm -f 1 -l 1 \
				  -scale-to-x "${DEFAULT_SIZE%x*}" \
				  -scale-to-y -1 \
				  -singlefile \
				  -jpeg -tiffcompression jpeg \
				  -- "${FILE_PATH}" "${IMAGE_CACHE_PATH%.*}" \
			 && exit 6 || exit 1;;

Additionally, if you want to view images in ranger preivew, install ueberzug, add the following lines to your rc.conf:

set preview_images true
set preview_images_method ueberzug

Make sure you have sxiv installed. Then, in rifle.conf, move the "mime ^image, sxiv..." line to the top of the of the image section, above inkscape. In the arguements at the end of the line, add "-a" so it can play gifs when you open images. This should improve the quality of life when using ranger.

November Update

2020-11-01

life


I've cleaned up this website a bit and removed the food blog. I was bored when I made it in the summer and I don't really feel like taking pictures of my food every time I eat. Additionally, I added more information about me as a programmer in the "About Me" page

My interests have shifted during the fall season. I've gotten back into chess. My rapid chess rating(5 minute games) as increased by 200 points since September. I think once this corona virus ends, if it does end, I'll be going back to chess tournaments. In the past couple years I felt that there was something missing from my chess play style. I played too boring, and not very good. So nowadays on chess.com I've been playing much more tactical. I feel myself getting better at the game every week.

Classes are a bit rough, although I feel that I am learning more material.My master program made me take some really lame classes the first and partly the second semester. But now I've reached the content that actually makes me feel like theres some value to a college education.

On a side note, I love going to the gym at 11:30pm. Its no because I'm being self conscious, but every time I go nowadays all the barbells stations are packed, and some people take 30 minutes to a single rep. Plus its quiet which is nice.

Markov Decision Process

2020-10-14

machine_learning, technology, reinforcement


The formatting is weird because I typed it up in LibreOffice. Next time I'm just going to use MathML or MathJax

Trying out Suckless

2020-09-05

life, technology


I'm going to try to start using suckless software. If you don't know, suckless is a group of succiently written software that needs to be recompiled to update changes. The software is lightweight and powerful, but the community is very elitist, as there is really no documentation on how to do stuff. I might write a tutorial later once I figure out everything. Right now I'm using their terminal emulator, st. Later this week I'm going to test out dwm, which is their window manager. Thats all for now

How To Record a Video in Scala Using OpenCV

2020-09-01

technology, image_processing, scala


This semester, I want to get more comofortable with functional programming languages, so I'll be recording my progress through the course I'm taking this semester, Computer Vision. I know some Haskell and F# and I am opportunist with functional aspects in Python, but there is still much I do not know about FP. I am run Arch Linux on a Thinkpad for these projects.

Why Use Scala: Scala a strongly typed functional and object oriented programming language that utilizes the JVM. Scala allows the ability to write powerful functional code while having access to all the tools in Java such as Apache Software. Overall, Scala has the potential to be powerful for data processing and engineering.

Unfortunately, scala tutorials are much more sparse than languages like Python. Thus, I want to record my progress with this language.

First scala and sbt. SBT is the tool that allows to manage our scala projects.

sudo pacman -S scala sbt

If you're running arch linux, install scrot so we can take screenshots

sudo pacman -S scrot

For this assignment, we will install OpenCV, take a selfie, and record a video using scala.

Recording Video With JavaCV

create a folder and then initalize your sbt project. Download the hello world layout and name your project whatever.

sbt new scala/helloworld.g8

Read this documentation to understand how sbt works. Run sbt and then type '~run' You should see the output:

[info]   Compilation completed in 11.595s.
[info] running Main
Hello, World!
[success] Total time: 76 s (01:16), completed Sep 1, 2020, 3:09:58 PM
[info] 1. Monitoring source files for computervisionhw1/run...
[info]    Press  to interrupt or '?' for more options.

Now we need to configure our build.sbt. Since OpenCV is written in C++ we will need to get a Java wrapper: JavaCV. [Maven Repo] [Documentation][Github]

build.sbt
scalaVersion := "2.13.1"
name := "hello-world"
organization := "ch.epfl.scala"
version := "1.0"
libraryDependencies += "org.typelevel" %% "cats-core" % "2.0.0"
libraryDependencies += "org.bytedeco" % "javacv-platform" % "1.5.3"

If your versions are correct, you should get no errors.

Now to take a selfie and record a video.

Main.scala
import org.bytedeco.opencv.opencv_core._
import org.bytedeco.opencv.opencv_videoio.VideoCapture
import org.bytedeco.opencv.opencv_videoio.VideoWriter
import org.bytedeco.opencv.opencv_core.Size
import org.bytedeco.opencv.global.opencv_imgcodecs._
import org.bytedeco.opencv.global.opencv_highgui._

object Main extends App {
  var imageArray = new Mat();
  var videoDevice = new VideoCapture();
  videoDevice.open(0); // String input for specific video, but since this is the camera, the parameter is 0
  if (videoDevice.isOpened()) {
      // Take Selfie
      videoDevice.read(imageArray);
      imwrite("myselfie.jpg", imageArray); // use imwrite func to write to file
      // To write a video, we will need to use the video writer class in javacv
      var videowriter = new VideoWriter("myvideooutput.avi", // output file name
                                        VideoWriter.fourcc('M','J','P','G') //codec used
                                        ,10 // fps
                                        ,new Size(imageArray.arrayWidth,imageArray.arrayHeight)); // frame size

      // Build video that is 100 frames
      val i = 0;
      for(i <- 1 to 100){
        videoDevice.read(imageArray);
        imshow("frame",imageArray); // display widow of video
        videowriter.write(imageArray);
        waitKey(1); // need to display image on window. 0 to pause after every frame, 1 or greater to play it
      }

      // Release objects
      videowriter.release();
      videoDevice.release();
      destroyAllWindows();
  } else {
      println("Error, no camera found.");
  }
}

execute sbt run. Lets me test my results...

It works!

I know this code isn't very in the spirit of functional programming. However, OpenCV is written in C++, so it is necessary to write procedural code. This is actually a benefit of Scala, that we can take the benifits of OOP in Java and combine it with functional syntax. Thats all for now!

Wind/Pinball Reivew

2020-08-21

books


    I recently read the book Wind/Pinball. The book contains two stories, and follows the life of young men through their young adult life. Personally, I didn't find the first story of 'Wind' particularly interesting, however, it was made tolerable by Haruki Murakami's writing style. The second story, Pinball, I enjoyed much more.

    Pinball is about a man and his relationship to a pinball machine, Spaceship. This story cuts deep into my soul.

    Bonus Light, a book-length study of pinball, says the following in its introduction: Almost nothing can be gained from pinball, The only payoff is a numerical substitution for pride. The losses, however, are considerable, You could probably erect bronze statues of every American president(assuming you are willing to include Richard Nixon) with the coins you will lose, while your lost time is irreplaceable.
    When you are standing before the machine engaged in your solitary act of consumption, another guy is plowing through Proust, while still another guy is doing some heavy petting with his girlfriend while watching True Grit at the local drive-in. They're the ones who may wind up becoming groundbreaking novelists or happily married men.
    No, pinball leads nowhere. The only result is a glowing replay light. Replay, replay, replay--it makes you think the whole aim of the game is to achieve a form of eternity.
    The goal of pinball is self-transformation, not self-expression. It involves not the expansion of the ego but its diminution. Not analysis but all-embracing acceptance.
    If it's self expression, ego expansion, or analysis you're after, the tilt light will exact its unsparing revenge.

    Have a nice game!

     This book was pretty relatable because I too had once an asymmetical relationship with pinball, I was sucked into an universe that was independent of time, in a zen state as my wallet was getting drained, mesmorized by the flashing lights and mechanical sounds. Like the narrator in the novel,I I was entraced in a deadly relationship with a machine that is sucks your life away, but you can't just leave the machine, it becomes a real thing to you.

    However, for him, one day the pinball machine was removed, and he thus went on a quest to find it. He eventually does, and he and the machine have a dialouge together, like their lovers saying goodbye for the last time. By the end of the novel, he parts ways with the machine. I guess its cliche but he learns to let go and move on with his life. I think in the modern world we develop intricate relationships with material objects, and even though we are deeply intangled in these relationships we lack the self awareness to treat these relationships with care. These objects can cause more greivences in our lifes than any person every could, and it can be scary since this is relatively new thing(at a large scale at least) for this to happen to people. But part of growing up isn't to folow sound guidlines to life, but to recognize our own emotional hurdles and overcome them. Despite the narrator's bizzare relationship with pinball, he was able to overcome his distress.

    The books touch on the expirence of young adult life, and throughout the books, I found reflections of the characters in myself. I'm sure theres some stuff about the book I forgot to mention, and some symbolism I missed, but I found the book to be a comforting expirence.

7.5/10

Updating my vim config

2020-08-20

programming, technology


    I recently got a cheap laptop off craiglists that I can put arch linux on. I'm sick of MacOS and so I'm going to start using that laptop for school. Btw, never install linux on a mac. Its a huge pain and it didn't work out in the end. I had so many weird problems during installation that I didn't have with a thinkpad and in the end I needed to reset the motherboard. For example, I was able to connect to the internet, but the speed was in the single kilobytes. But I did have connection. There was some kind of problem with the driver. Also, alot of other stuff wasn't working. So just get a really cheap windows laptop and replace W10 with Arch or Manjaro.

    The extensibility vim is wild. Vim has always been my goto terminal editor, but I really want to take it to the next level and use it as my primary coding environment, instead of having to use VSCode and JetBrainlet software.

    You can check out my dotfiles here.

Email Server

2020-08-10

life


[Originally written August 5th]

I created my own email server today. It was pretty easy using this script. If you have any questions, contact me at my new email address.

I have a huge backlog of books I want to read.

Seeya

Its Been A While

2020-08-10

life, machine_learning, programming


[Originally written August 2nd]

It's been a while.

    First off, I added a git server to my website, so I can host projects myself to avoid being completely dependent on Microcock software, a.k.a GitHub. Setting up a git server is actually pretty easy. I also used stagit[1][2] to generate static html for the projects. It went relatively smoothly, except I had to compile libgit2 as a dependency and fix an error with shared libraries, but the problems were straightforward to solve. However, it was a huge pain getting my DNS records and cnames working. Mostly because my cname www.pascalbakker.xyz to pascalbakker.xyz couldn’t be used because of some CAA record. That took up way more time than I’d like to admit, though I do understand DNS more now though after researching this stuff. Link

    I’ve also been learning a bit of Haskell. I did some simple coding challenges in the language online and have been watching this youtuber called Tscoding. He created a really great video on how to create a json parser which taught me alot. I think I have a strong enough understanding of monads and other aspects of Haskell to actually code in it, although every bit of code takes a while for me to generate. Overall, I’m having fun. I didn’t get to do much algorithmic coding this summer, so it's a nice challenge. Plus who knows, maybe I might rewrite this entire website’s backend in Haskell.

    I also finished the book Kafka on the Shore. I’ll give a review of that in another blog. I picked up another book recently by the same author, Haruki Murakami, titled "Wind / Pinball". For the next couple weeks I’ll be watching over my parent’s cats, so I’ll have plenty of time to read and stuff. Although, I’ll probably just end up browsing stuff online and not getting anything done.

Seeya

Last Week Of June

2020-06-30

books


Last week I read two books: Everything I Want To Do is Illegal and This Side of Paradise. The first is a nonfiction book and it discusses the madding experience of trying to deal with bureaucrats when running a small farm. The author runs an semi-organic old fashioned farm and is constant thwarted in doing the right, rational thing by bureaucratic laws that are completely disconnected from the reality. For example, he can’t process his meat on his own land; instead he has to send it to another faculty and have it returned as a ‘value-added’ product. Or he can’t have schools visit his farm for field trips or else he would be considered an amusement park and would have to follow another set of regulations. Beyond all the enraging regulations, he brings up a key point. Why do you have so much faith in our institutions? A conservative will have faith in the military and NSA are making a positive contribution to the country, while disavowing the EPA, USDA, FDA, etc. However, liberals tend to be the opposite, and put their faith into the EPA, USDA, etc while despising the military. We assume the institutions we like are making a positive impact because their goals are noble, but noble goals does not necessarily mean their impact is positive. In the case of farming, its nearly impossible to be a small farmer in modern America; you cannot stay ahead of government regulations. As a result, only big industrial corporations have what it takes to withstand the autocrat. This book is a gateway into becoming a libertarian. Let farmers farm. Don’t fall for the alluring top-down approach trap. I love this book and recommend it to anyone.

The second book, This Side of Paradise by Scott F. Fitzgerald, takes place in England during WWI (go figure) and was his first published novel. Its follows the inner conflict of a young boy named Amory and his egotistical and conceited attitude towards life’s problems. Because thinks very highly of himself and thus as a result thinks very poorly of himself. While he is egotistical, its in a very human and relate-able way. This book has excellent writing and great dialogue I recommend this book if you enjoy the Great Gatsby or any other of his works; or if you need to regain some empathy.

I got my hands on two more books: Antifragile by Nassim Taleb and Kafka on the Shore by Haruki Murakami. Hopefully I’ll write review for these when I finish, they’re pretty long.

Seeya

Back To Main Page