Let's write a simple module to control OBS using websockets. OBS already have a websocket server which can accept many command to control its features. We're going to use that websocket server to make some actions like: Change scene Apply source filters Many other things Basic configuration First we need to install a websocket client, fresh is a easy to use client that works on top on mint. Let's add the following code to our mix.| erick.navarro.io
Code search is a useful tool to search for examples about some function, class, etc. We're going to create a Alfred workflow to easily search into GitHub Code search and SourceGraph Create a workflow Let's go to Alfred settings/Workflows/+/Blank workflow Name our new workflow, you can use whatever name you want, let's put "Code search" Create a new element of type script filter Now we need to make some adjustments over the defaults values:| (ノ°Д°)ノ︵ ┻━┻
I've been using helm for many years, since I started to use emacs itself. It was great because it is a "all in one" tool, very convenient when starting in emacs world. The problem(?) Actually there is a not problem perse, just maybe the "startup time", I had the load deferred so the first time I call some function from helm there was a little "wait", nothing really bad but a little annoying| (ノ°Д°)ノ︵ ┻━┻
Some days ago I saw a tweet(detail below) that show an interesting feature, a way to select terms using the mouse. After seeing that I thought it will be easy to implement using tree-sitter. doubleclick to select term, the way nature intended pic.twitter.com/O123K12AHp — andrew blinn (@disconcision) October 31, 2022 To be able to implement this we just need tree-sitter.el which will allow us to select terms using grammars.| (ノ°Д°)ノ︵ ┻━┻
tree-sitter is a great tool to have an incremental syntax tree of our code, in emacs it can be used to add syntax highlighting instead of using the regular regex based highlighting system. There are other use cases for this and now we're going to use it to build a simple tool to run ispell using the content of a text node, of course we can select the text manually but it will be easier and fancy to do it in a programmatic way using the syntax tree generated by tree-sitter.| (ノ°Д°)ノ︵ ┻━┻
Let's create a Alfred workflow to search for memes in a folder(our collection) and put that image in the clipboard so we can user it wherever we need it. Yes, it sounds useless but it was fun to made. First we need to cover some things to understand how an Alfred workflow works. There are many types of elements to build a workflow, this time we're going to use 2 specific elements:| (ノ°Д°)ノ︵ ┻━┻
Having our emacs configuration in an org file is great, it allow us to have it more organized and easy to read, but org files have more features and one of them is the ability to be exported to different formats like HTML, PDF, markdown and so on. So what if we export our emacs configuration to HTML and then publish it in a website? 🤯 It probably doesn't have any real utility but it would be nice to have a exclusive web page to show our emacs config to our friends :)| (ノ°Д°)ノ︵ ┻━┻
I have a personal server where I run some projects, some of them written in python, elixir and other technologies so having to deal with specific installation of any of these technologies is not an ideal workflow, to fix this I use docker and all of them are deployed using docker-compose, they're connected to a single PostgreSQL server and they're behind the same web server. Running all of these projects in this way it's easier to maintain and in case something happens with the server I can r...| (ノ°Д°)ノ︵ ┻━┻
Compilation mode is a major mode that allow us to run a command and see its output result in a special buffer, this resulting buffer show the errors and allow us to navigate through them, you can check the documentation for more details. It's a "simple mode" but it can be used for many things like compile and run a program, run tests, and so on. Usage Interactive compile is an interactive function so we can call it with M-x compile and enter the command we want to execute.| (ノ°Д°)ノ︵ ┻━┻
These are some things I commonly use in my elixir development workflow that might be interesting for someone. Managing multiple versions of elixir and erlang When you have to work in more than one project at time that could probably means you have to handle different elixir and erlang versions so installing the default version that your OS provides won't be helpful. Here is where asdf shines to solves this problem, asdf allow us to have different versions of elixir, erlang and other languages...| (ノ°Д°)ノ︵ ┻━┻
What is tsung Tsung is a load testing tool written in erlang, it allow us to perform load testing for web applications, databases, etc. Or as its website says: Tsung (formerly IDX-Tsunami) is a distributed load testing tool. It is protocol-independent and can currently be used to stress HTTP, WebDAV, SOAP, PostgreSQL, MySQL, AMQP, MQTT, LDAP and Jabber/XMPP servers. More info is available in its web page http://tsung.erlang-projects.org/user_manual/ In this post we'll cover how to test a web ...| (ノ°Д°)ノ︵ ┻━┻
These are some are thoughts to keep in mind when we're contributing to a software project. Know your tools Git is maybe the most extended tool to manage version control in software and as a daily tool we should invest some time in knowing how to use it "properly". Configure your name and email properly This helps to identify who make a change while we're browsing git log history. Don't use initials or nicknames, in a few months or maybe years eventually you will be looking at the git log and ...| (ノ°Д°)ノ︵ ┻━┻
Kubernetes cli tool kubectl is pretty useful but when I need to execute some tasks many times during a work day it could be too verbose. So I wrote some bash functions to handle a few common tasks I use often. I used the power of fzf to create an interactive experience when I run any of these functions. Basically it pipes the output of a kubectl command, make some filtering using sed and awk and then build a final command which will execute what I want.| (ノ°Д°)ノ︵ ┻━┻
Org-mode has a nice feature that allow us to edit source code within an org file, for more info check the docs. But it has a little annoying behavior after we are done editing a source block. It loses the previous window configuration and always closes all the windows except the org window. In the image below we can see this behavior: To solve this problem we can use a simple variable to store the current window configuration just before the source code edition buffer is opened and when it's ...| (ノ°Д°)ノ︵ ┻━┻
When we're developing some application we frequently interact with APIs. There are applications like postman, httpie, insomnia and so on to accomplish this task but having an external application only to test a few endpoints or even a complex API is a little overkill. Using emacs and a great package called restclient.el we can have a very complete tool to handle API requests without leaving our favorite editor. Installation Put these lines of code in your emacs configuration and you'll be rea...| (ノ°Д°)ノ︵ ┻━┻
I've been working professionally with Elixir for 7 months, obviously using emacs as my daily editor. In this post we'll see some packages that could be useful for Elixir development. I'm not using LSP (yet), so the goal here is just to have a minimal setup for Elixir development. We're going to use use-package to install all the needed packages. Syntax highlighting We'll use Elixir-mode. This package give us syntax highlighting support and some useful features like mix-format which let us for...| (ノ°Д°)ノ︵ ┻━┻
Some weeks ago I discovered a really nice package for emacs called reformatter.el. This package allows to define reformat functions in a easy way. Most languages have a reformat tool. Elixir has mix format, Elm has elm format, python has black and so on. These formatters are convenient because they give uniformity to the code, but this is a topic for another post. Having these formatters integrated within our favorite editor is great.| (ノ°Д°)ノ︵ ┻━┻
When we are using emacs sometimes we often open many buffers in different windows at the same time, for example we can have a buffer for a opened file, another for seeing test results and so on. There are some tools to manage "sessions" but I wanted something simple and I also wanted to learn a little bit more of elisp so here is the result. (defvar window-snapshots '()) (defun save-window-snapshot () "Save the current window configuration into `window-snapshots` alist.| (ノ°Д°)ノ︵ ┻━┻
Emacs packages Project Description linkode.el Upload code within a buffer or a region in Emacs to linkode.org (a pastebin like service). tree-sitter-ispell.el tree-sitter plugin to run ispell on text nodes in different languages flymake-sqlfluff flymake plugin for SQL using sqlfluff flymake-ruff flymake plugin for python linter ruff cloak-mode Minor package to hide sensitite data using multiple regex per major mode Python libraries Project Description Serpost Fetch tracking data from Peruvian...| (ノ°Д°)ノ︵ ┻━┻
Hugo is a static site generator that just like another alternatives(Nicola, Jekyll, etc) allows to write in plain text and generate html, js, css files. Hugo is so much simpler to use because it's a simple binary file that allows to develop and prepare the site to be published.| (ノ°Д°)ノ︵ ┻━┻
Hi there 👋, I'm Erick Navarro, software developer (a.k.a bugs creator). I've worked mostly doing web development using Python but now I work using Elixir also doing web. I'm very interesting in functional programming and that's why I spend time learning cool tech like Haskell and Clojure. I'm a emacs lover and that made me spend many hours tuning my emacs config (I regret nothing). You can follow me on Twitter, GitHub and now also on Twitch where I stream about programming stuff in Spanish.| erick.navarro.io
direnv is a tool to set up automatically environment variables as soon as we enter in a directory that contains a .envrc file. We can use this feature to activate our virtualenvs as well. Let's see what happens when we activate manually a virtualenv with source ./env/bin/activate: A new new environment variable called VIRTUAL_ENV is exported. The path is updated to include the bin directory inside our virtualenv this is made to allow us to point to the correct python installation and run cli ...| erick.navarro.io