Dill Pickle Recipe


INGREDIENTS:

12-14 Persian cucumbers or 8-10 pickling cucumbers

4 garlic cloves, halved

2 teaspoons of mustard seeds

2 teaspoons of peppercorns

a few good-sized dill springs, per jar

2 cups of water

2 cups of distilled white vinegar

1/4 cup of cane sugar

2 tablespoons of sea salt

INSTRUCTIONS:

  1. To make dill pickle spears, slice the cucumbers lengthwise into quarters. To make dill pick chips, thinly slice them horizontally
  2. Divide the cucumbers among 4 (8-ounce) or 2 (16-ounce) jars. Divide the garlic, mustard seeds, peppercorns, and dill springs among each jar.
  3. Heat the water, vinegar, sugar, and sea salt in a medium saucepan over medium heat. Stir until the sugar and salt dissolve, about 1 minute. Let cool slightly and poor over the cucumbers. Set aside to cool to room temperature, then store the pickles in the fridge.
  4. Pickle spears will be lightly pickles in 2 days, but the best flavor will start to develop around day 5 or 6. Pickle chips will be lightly pickled in 1 day, and will become more flavorful every day after that. Store in the fridge for several weeks.

Pasta Frola


Ingredientes:

1 taza de azúcar (200 gramos)

1 1/2 tapas de harina leudaste (300 gramos)

1 huevos entero, 2 yemas

100 gramos de manteca

1 cucharadita de esencia de vainilla

1 pizca de ralladura de limón

400 gramos de dulce de membrillo

Utensilios:

Molde

Espátula de silicona

Bowl

Tamizador

Instrucciones:

Mezclar en un bol el azúcar con la manteca a temperatura ambiente. Incorpora los huevos uno por uno, y la esencia de vainilla y la ralladura le limón. Poco a poco tamizar, añadir, y juntar la maza.

Vuelca la maza en una superficie enharinada y amasa hasta obtener una masa blanda, deja la masa en la nevera por 30 minutos aproximadamente.

Engrasa y espolvorea con harina un molde para horno, y entiende la masa con los dedos. Agrega el membrillo sobre la base de masa de pasta frola que ya has preparado, espárcelo bien por todas partes y cúbrelo con tiras de masa para decorar.

Temperatura de el orno es 350 F esta que este dorado o 20 o 30 minutos.

Keto Danish Butter Cookies (30 cookies)


Equipment

  • Baking Sheet
  • Mixing Bowls

Ingredients

  • 1.25 cups almond flour
  • 1/4 cup coconut flour
  • 1/3 cup Low Carb Sugar Substitute
  • 1 tsp baking powder
  • 6 tbsp butter, room temperature
  • 1/2 tsp vanilla extract

Instructions

  • Preheat oven to 350°F and line a baking sheet with parchment paper or a silicone mat. 
  • In a mixing bowl, combine almond flour, coconut flour, erythritol, and baking powder; mix well using a spoon.
  • Cut in the butter and vanilla and work it with your fingers until a dough forms.
  • Use your hands to roll the dough into 12 equal balls. Place the balls 2-inches apart on prepared baking sheet. Use a fork to flatten and create a striped pattern.
  • Bake the cookies for 11-14 minutes, or until browned around the edges. Transfer to wire rack to cool.
  • Best stored in an air tight container or zip top bag in the fridge up to 10 days.

Notes

Net Carbs: 2g per servingYields: 12 Cookies

Nutrition

Calories: 128kcal | Carbohydrates: 4g | Protein: 3g | Fat: 12g | Fiber: 2g

mplayer seamless loop in Raspberry Pi


Have you ever tried to run a video on an infinite loop with mplayer?

You will find that most players (including VLC) will do a ‘restart’ after each loop. That stuttering is very annoying when you are trying to build a kiosk mode screen display.

We can achieve a seamless infinite video loop with mplayer with a command like this:

mplayer -fs videofile.xyz -loop 0

Please note the “-loop 0” option is at the end. If you put this option before the file name, it will cause a restart on every loop. Apparently, this behavior comes from a very old quirk

Get 16v out of a MagSafe2 Apple Charger


If you read the specs for a MagSafe2 Apple Charger, it says output 16.6V 3.5A, which can be useful when you are looking for a 12V source power for i.e. a battery.

But, if you just cut the Magsafe2 cable and measure the voltage, you’ll read only around 0.3V.

What’s the trick?

This charger has an internal 16-bit microprocessor. You need to put a resistance between both terminals (i.e. 22K Ohm), to tell the microprocessor that there is a resistive load between terminals (same does your mac when you plug it).

When the microprocessor registers this load, after 1 second, it will deliver the 16V.

Now you can use this charger to regulate the output (maybe using an lm2596) and charge a 12V battery…

More information: http://www.righto.com/2013/06/teardown-and-exploration-of-magsafe.html

12V Battery Charging


Measuring current to detect when the battery is fully charged:

In normal (old age) battery chargers there will be the Ammeter connected in series between the battery and the battery charger.

When the battery is almost full. The current will gradually descend near zero. Because both voltages are almost the same. Until the current flows less.

Due to the V = IR rule, if the charging voltage V increases. It will cause the charging current (I)to decrease.

In modern battery charging circuits, The battery voltage will be measured. When the voltage is indicated that the battery is fully charged. The system will automatically cut off the power more convenient.

Reference: https://www.eleccircuit.com/how-many-amps-hours-to-charging-battery-full/

Flush DNS on Mac


Making DNS changes and wanting to force a flush on a Mac?

Here are the commands for the different mac versions:

MacOS VersionCommand
macOS 12 (Monterey)sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
macOS 11 (Big Sur)sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
macOS 10.15 (Catalina)sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
macOS 10.14 (Mojave)sudo killall -HUP mDNSResponder
macOS 10.13 (High Sierra)sudo killall -HUP mDNSResponder
macOS 10.12 (Sierra)sudo killall -HUP mDNSResponder
OS X 10.11 (El Capitan)sudo killall -HUP mDNSResponder
OS X 10.10 (Yosemite)sudo discoveryutil udnsflushcaches
OS X 10.9 (Mavericks)sudo killall -HUP mDNSResponder
OS X 10.8 (Mountain Lion)sudo killall -HUP mDNSResponder
Mac OS X 10.7 (Lion)sudo killall -HUP mDNSResponder
Mac OS X 10.6 (Snow Leopard)sudo dscacheutil -flushcache
Mac OS X 10.5 (Leopard)sudo lookupd -flushcache
Mac OS X 10.4 (Tiger)lookupd -flushcache

Raspberry Pi + Java R2D2 Robot – Part 2


We started this project during the pandemic, back in 2020 as project for my kids.

Today R2D2 gave it’s first baby steps on the house. Lot’s of work ahead handling obstacles, video recognition, among others… but a lot of fun!

R2D2 vision camera while walking the house.

Interior of the tube. Raspberry Pi 3. Servo Motor Conroller. Voltage regulator and battery.

My kids practicing some soldering….

Part 1 is documented here: https://vivani.net/2020/04/27/raspberry-pi-java-r2d2-robot-part-1/

Java code available here: https://github.com/hvivani/Robotics/tree/master/R2D2

Emacs on MAC OS X


Installing Emacs

Get Homebrew, then, in the terminal, install emacs-plus:

brew install d12frosted/emacs-plus/emacs-plus@28 

Link to emacs in “/Applications” with:

rm -rf /Applications/Emacs.app && ln -s /usr/local/opt/emacs-plus@28/Emacs.app /Applications

Emacs For the Dummies

To run emacs, just type:

   emacs filename

where filename is the file you want to edit.

On PowerPC desktop or any workstations with X windows, you may want to put the emacs session into background so that you can still use the current xterm window, just type

   emacs filename &

Once you are in emacs, the top menu bars offer the four sub-menus:

   Buffer   File   Edit    Help

The sub-menu Buffer allows you to switch between different files that you are editing. The sub-menu File contains commands on how to open another file, save files, exit emacs, etc. For example, to open a new file, just click the File button and the Open File… option, the cursor will then jump to the minibuffer at the bottom of the screen; you can type in the file name, the one which you want to open, and type the “return” key.

Alternatively (preferred by most people), you can use the key bindings to do most of these and more.

Use the arrow keys to move the cursor

C-x C-f         open a new file
C-x C-s         save the current file
C-x C-c         exit the emacs (but save files first)

Here, the prefix C- refers to the CONTROL key, the prefix ESC- refers to the ESCAPE pkey. For example, C-x means to simultaneously press the CONTROL key and the “x” key.


Key Bindings

In the following, the prefix C- refers to the CONTROL key, the prefix ESC- refers to the ESCAPE key. For example, C-n means to simultaneously press the CONTROL key and the key “n”. Lines

C-a             go to the beginning-of-line
C-e             go to the end-of-line
C-n             go to next-line
C-p             go to previous-line
C-k             kill the current line
C-o             open-line

The following two bindings are CS210 specific:

  C-x C-g         go to a specific line numbered x 
  C-x C-w         show (in the minibuffer ) the current line number

Words

ESC f           forward-word
ESC b           backward-word
ESC d           kill-word
ESC DEL         backward-kill-word

Characters

C-f             forward-char
C-b             backward-char
C-d             delete-char
DEL             delete-backward-char
C-q             quoted-insert
C-t             transpose-chars

Regions

C-space         set a region mark
C-w             kill-region (between cursor and mark)
ESC-w           memorize the contents of the region (without kill)
C-y             yank (i.e., insert text last killed or memorize)

Screen control

C-l             recenter
C-v             scroll-up (forward)
ESC-v           scroll-down (backward)
ESC <           beginning-of-buffer
ESC >           end-of-buffer

Search

C-s             isearch-forward
C-r             isearch-backward

Files

C-x C-f         find-file
C-x C-r         find-file-read-only
C-x C-s         save-current-file

Windows

C-x 1           delete-other-windows
C-x 2           split-window-vertically
C-x 4 f         find-file-other-window
C-x o           other-window

Command execution

ESC !           shell-command
ESC x compile   compile ("make -k" is default)
C-x `           next-error
                (used after "compile" to find/edit errors)

Miscellaneous

C-x C-c         save-buffers-kill-emacs
C-u             universal-argument
C-x C-z         suspend-emacs
                (resume by typing "fg" to unix)

Help!

C-g             keyboard-quit
C-h             help-command
C-h t           help-with-tutorial
C-h b           describe-bindings
                (complete list of emacs commands)

Commands for Compiling

ESC-x compile

Runs the compiler, linker, etc.

If this is the first time you have issued this command since entering emacs, the minibuffer at the bottom of the screen appears filled with make -k. If you’re not using make -k erase the minibuffer line (e.g., using DEL) and type in the compiler command of your choice, e.g., gccx hello.c. This command is remembered for subsequent executions of ESC-x compile. When you type RETURN, if there are unsaved buffers, you will be given the opportunity to save each one. The screen then splits into two windows, and the output from the compilation command appears in one of the two windows. If there are parse errors, use the following command.

C-x `

Finds the locations of errors. Each time this command is given after a compilation that found errors, another line of parse errors is located. The compilation window is scrolled up, so that the topmost line displays the a new parse error. The other window changes buffers, if necessary, and displays the source line associated with the error. Note that if your program consists of several files, this command locates the file and loads it into the buffer. The cursor is placed at the line containing the error. You may edit the file to correct the source of the error and repeat the command again to find additional errors. When you have done the most you can with this batch of parse errors, give the ESC-x compile command again.


Commands for Debugging

ESC-x gdb

Runs gdb, the GNU interactive debugger.

The minibuffer at the bottom of the screen prompts you for the name of your executable file. Unless you compiled with the -o option to name the output file, the name of your executable file is a.out. When you type in the file name followed by RETURN, the screen splits into two windows (or remain split if it is split already). One window is used for interactive input and output to gdb. The other will eventually display your program files for you to examine and edit. Sometimes the screen doesn’t divide immediately after ESC-x gdb, but gdb takes over the whole window where it was executed from; the screen divides the first time you run the program and it stops because of a breakpoint or an error caught by the debugger. So, if the window doesn’t split and you want to follow the behaviour of the running program, just type break main before you run it the first time. When execution reaches main, the window splits as described above, an arrow points to the current position in the code, which is the first line of main.

The cursor initially is placed after the gdb prompt (gdb). Whenever you want to issue a command to gdb, position the cursor at the end of the buffer, i.e., after the (gdb), and type the command as usual. The command ESC-> gets you to the end of the buffer. To examine previous input or output to gdb, use the usual emacs commands to move around the buffer.

Whenever your program, which was running under gdb, stops because of a breakpoint an interrupt, etc., the source code associated with the current locus of execution is displayed automatically in the other window. A marker, =>, points to the specific line. If you use the frame command to change frames, the source for the new frame is displayed and the marker is placed accordingly.

When you find an error, you may change the source code and save the file. However, before recompiling, give gdb the command kill to cancel your running program. Otherwise, when the compiler runs the linker to link your program you’ll get the error `text file busy’ and a new executable file will not be written.

After recompiling a program, you should reload the symbol table and the executable, otherwise you’ll be running the previous program. To do so, execute

(gdb) exec-file program-name

(gdb) symbol-file program-name

The symbol-file command will request confirmation before reloading the symbol table; just answer yes.

ESC-x gdb-break

Sets a gdb breakpoint at the source line on which the cursor appears.

Commands for Controlling Windows

Windows in emacs usually refer to subdivisions.

C-x 1

Reformats screen into one window, retaining only the window in which the cursor appears.

C-x 4 f

Finds a file and displays it in the other window (the window in which the cursor does not appear). If the screen has only one window, split it into two. The C-x 4f command prompts for the file name.

C-x o

Moves the cursor to another window.

Windows in the usual sense are called frames in emacs. You can use frames only if you are using PowerPC desktops or any workstations with X window systems. Frames give you true separate emacs windows at the same time. Clearly, you can not use frames if you are using a text-based terminal (e.g., via remote telnet or remote login).

C-x 5 2

Creates a new frame.

C-x 5 f

Finds a file and displays it in the other frame (the frame in which the cursor does not appear).

C-x 5 0

Deletes the selected frame. This is not allowed if there is only one frame.

Cua-Mode

Cua-mode is part of GnuEmacs versions 22.1.1 and later (at least).Cua-mode allows one to use ‘C-v’, ‘C-c’, and ‘C-x’ to paste, copy, and cut the region.