Tips & Tricks Blog
Notes, ideas and general comments on anything related to high-tech.

July 30, 2021

Adding borders to terminal windows under Ubuntu 18.04

Filed under: Linux

The new fashion of having borderless windows is quite annoying (struggled with that under both MS Win 10 and Ubuntu).
Here’s the solution for Ubuntu (combined from a couple posts on stack overflow)…

First make “~/.config/gtk-3.0/gtk.css” with the following content:

decoration {
  border: 1px solid gray;
  background: gray;
}

Second paste this into shell and after that run “reload_gtk_theme”:

function reload_gtk_theme() {
  theme=$(gsettings get org.gnome.desktop.interface gtk-theme)
  gsettings set org.gnome.desktop.interface gtk-theme ''
  sleep 1
  gsettings set org.gnome.desktop.interface gtk-theme $theme
}

Keyboard Input Problem with nedit under Ubuntu 18.04 in Virtual Box

Filed under: nedit

I had to start using nedit under Ubuntu 18.04.5 in VirtualBox under Win 10 and unfortunately encountered an intermittent problem with the keyboard input stopping to work (see post here: https://www.okob.net/wp/index.php/2021/07/30/building-nedit-ng-for-ubuntu-1804/).
After trying to use nedit-ng for a bit I decided to switch back and try to solve that keyboard input problem.

The repo with the fix is here: https://github.com/dob71/nedit
It solved the problem with the input into the edit windows, but introduced (or maybe they are unrelated) the problem with the dialog boxes.

I haven’t spent much time on the dialog boxes input problem yet. So far my solution was to link nedit statically under Ubuntu 16.04 (see “static-ubuntu16″ build configuration) where it worked flawlessly and run that executables under 18.04. It appears to work, but it has been only a week or so, not enough time to confirm for sure that the dialog boxes problem is gone. The edit windows keyboard input problem though is certainly resolved now.

Building nedit-ng for Ubuntu 18.04

Filed under: nedit

I had to start using nedit under Ubuntu 18.04.5 in VirtualBox under Win 10.
NEdit 5.7 that came with Ubuntu 18.04 and the binary that was perfectly stable under 16.04 (under ESXi) were both getting into state when the keyboard input wasn’t working (but Ctrl+ and functional keys still did).
I decided to give https://github.com/eteran/nedit-ng a try.

The build was pretty easy:
cd ~
git clone https://github.com/eteran/nedit-ng
sudo apt-get install qt5-default
sudo apt-get install libboost-all-dev
#bison --version (didn't need to install)
#cmake --version (didn't need to install)
sudo apt-get install qttools5-dev
cd nedit-ng/
mkdir build
cd build
cmake ..
make

The binaries are “nc-ng” and “nedit-ng”. They are a drop-in replacement for “nc” and “nedit”. I actually used a small script to use symlinks for switching between the original nedit and the ng one.

Since ng uses different configuration format you’ll need to import your original nedit config:
./nedit-import ~/.nedit/nedit.rc

Unfortunately there were some little misses that forced me to go back to using the old nedit (see the next post).
The particular thing that I couldn’t adapt to were the fonts and how nedit-ng runs the shell commands.
With ng it was impossible to display as many readable lines of code in the window as it was possible with the old nedit. As for the execution of the shell scripts, I’m using them often, for example, to select something in the code and pop up a window where grep output for that selection would show. The ng did not bring the focus to the new window, also no output showed up till the command finished executing. Also the cursor change indicating that a command is running happened in the window where it was kicked off rater than the window that was receiving the output.
Regardless, it was really exciting to see nedit reborn. I don’t know what’s the magic, but since I started using nedit many years ago no other editor was compelling enough to replace it for me. Hopefully the project is not abandoned and all the little gotchas will eventually be cleaned up.

November 28, 2020

Converting Old UPS to Power Control Box

Filed under: Uncategorized

This simple contraption was quickly put together a few years ago to allow remote power control over WiFi or USB dongle. It can be set up to work as a WiFi access point serving its own SSID or as a client connecting to an existent WiFi network. In order to control the power one has to connect over ssh. When connected a simple menu is presented for configuring the device or powering the outlets on or off.
Entering “s” (undocumented) while in the top level menu drops you into the shell.
Note: initially I had USB dongle connected permanently, but it was causing the board to drop into the bootloader prompt on boot when powered up without a PC connected.

The hardware:

It was made with old CyberPower 425VA plus Olinuxino A13 WiFi with relays module.
The power is fed to Olinuxino directly from the battery feeds. The battery is stored outside and connected to the red and blue terminals.
The outlets were rewired to be powered through the Olinuxino controlled relays.

The software:

Start with the pre-built image from here:
https://github.com/OLIMEX/OLINUXINO/blob/master/SOFTWARE/A13/A13-build/A13_olinuxino_Debian_kernel_3.4.90%2B_image_description.txt

The image file name is:
A13_debian_34_90_WIFI_RALINK_GCC_GPIO_X_I2C_100KHz_UVC_TS_FTDI_3G_video_accell_release_10.img
It’s big (almost 4GB), so torrenting it is the best option.

I’ll keep a copy on google drive till need to free up space:
https://drive.google.com/file/d/1DzbFk9hplX51KZCa82LuA3gB7mFvIfCW

The more detailed image flashing instructions are here:
https://www.olimex.com/wiki/Prebuilt_SD_card_images_running_debian

Install hostapd and dnsmasq:
https://www.olimex.com/forum/index.php?topic=1635.0

Pull (using GIT) or download and extract files from the repo (URL below) into “/ups” folder on the board:
https://github.com/dob71/olinuxino-powerctl

Set up the init script:
ln -s /ups/init.d/powerctl /etc/init.d/powerctl
/usr/sbin/update-rc.d powerctl defaults

Add user “admin” and set /usb/control as its shell in /etc/passwd.

Edit /etc/inittab to respawn getty with admin login instead of root on ttyS0
T0:2345:respawn:/sbin/getty -L -a admin ttyS0 115200 linux

Example session (the control board is in client mode connected to home WiFi):

$ ssh admin@192.168.1.152
Warning: Permanently added '192.168.1.152' (ECDSA) to the list of known hosts.
admin@192.168.1.152's password:
Linux a13-OLinuXino 3.4.90+ #1 PREEMPT Thu Jun 19 09:51:45 EEST 2014 armv7l

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Sat Nov 28 02:30:35 2020 from some.host.okob.net
Please press a key:
'w' - control WiFi, 'p' - control power, 'r'- admin password.
The system is in STA mode
Wireless device state:
wlan12    Link encap:Ethernet  HWaddr 48:02:2a:ea:11:1f
          inet addr:192.168.1.152  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:854 errors:0 dropped:4329 overruns:0 frame:0
          TX packets:251 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:173505 (169.4 KiB)  TX bytes:39336 (38.4 KiB)
'c' - client mode, 'a' - AP mode, 'e' - exit:
'w' - control WiFi, 'p' - control power, 'r'- admin password.
Current power state:
R1(surge outlet 1) : on
R2(surge outlet 2) : on
R3(surge outlet 3) : on
R4(battery outlets): on
1-4 toggle the state, 'u' - all on, 'd' - all off, 'e' - exit:
Current power state:
R1(surge outlet 1) : off
R2(surge outlet 2) : off
R3(surge outlet 3) : off
R4(battery outlets): off
1-4 toggle the state, 'u' - all on, 'd' - all off, 'e' - exit:
Current power state:
R1(surge outlet 1) : on
R2(surge outlet 2) : on
R3(surge outlet 3) : on
R4(battery outlets): on
1-4 toggle the state, 'u' - all on, 'd' - all off, 'e' - exit:
Current power state:
R1(surge outlet 1) : off
R2(surge outlet 2) : off
R3(surge outlet 3) : off
R4(battery outlets): off
1-4 toggle the state, 'u' - all on, 'd' - all off, 'e' - exit:
Current power state:
R1(surge outlet 1) : on
R2(surge outlet 2) : off
R3(surge outlet 3) : off
R4(battery outlets): off
1-4 toggle the state, 'u' - all on, 'd' - all off, 'e' - exit:
Current power state:
R1(surge outlet 1) : on
R2(surge outlet 2) : on
R3(surge outlet 3) : off
R4(battery outlets): off
1-4 toggle the state, 'u' - all on, 'd' - all off, 'e' - exit:
Current power state:
R1(surge outlet 1) : on
R2(surge outlet 2) : on
R3(surge outlet 3) : on
R4(battery outlets): off
1-4 toggle the state, 'u' - all on, 'd' - all off, 'e' - exit:
Current power state:
R1(surge outlet 1) : on
R2(surge outlet 2) : on
R3(surge outlet 3) : on
R4(battery outlets): on
1-4 toggle the state, 'u' - all on, 'd' - all off, 'e' - exit:
'w' - control WiFi, 'p' - control power, 'r'- admin password.
Connection to 192.168.1.152 closed.

November 27, 2020

CyberPower PowerPanel Personal Edition Settings

Filed under: Uncategorized

I retrofitted a couple old UPS boxes with external battery packs that provide more runtime, but I do not trust those UPS devices to calculate the remaining charge to decide when it’s time to shut down. I needed to set explicitly how much time I want the system to run on the battery power till it shuts itself down. Unfortunately, the UI does not allow to set that value to be outside of a small hardcoded range, however…
As of today CyberPower uses MySQL to store the setting. The screenshot below shows where the DB is stored on Windows 7 x64 machine and the field to tweak. Note, that the UI uses a drop down selection box, so it’s not going to show that value. Any change made through the UI is going to update it in the DB.

cyberpower_powerpanel_personal_settings_db

August 8, 2020

First hand experience with Samsung Galaxy S9 battery getting on fire…

Filed under: General — Tags: , , , ,

Wow, that was exciting…
My Samsung S9 battery bloated up popping the back cover open. I bought a replacement and was in the process of changing it when the old (bloated one) shorted somewhere inside in the bottom corner of the battery. It started by glowing in one small point then the whole thing started sizzling making lots of smoke. I tried to take it outside but made only a few steps before the whole thing got hot and scary to hold in hands, and I had to drop the phone. The battery remains popped out and started glowing red (I’m not exaggerating) then caught fire. Fortunately that main burning piece of the battery landed on the concrete part of the floor. The pieces that landed on the carpet were so hot that they melted it. Those were not thick big pieces that can absorb a lot of heat, pretty much just a copper foil (I guess with a bit of still reacting lithium).

The tip of the day: BE VERY CAREFUL PRYING OUT LI-ION BATTERIES, ESPECIALLY AVOID THE CORNERS.

Surprisingly, the phone still works, just the speaker board needs replacement…
And as I recently noticed there is now a yellow tint in a few places where LCD was damaged by the heat.

December 15, 2018

Printing Alloy 910 from taulman3d.com

Filed under: 3D Printing

For my first experimental print the nozzle temperature was 250C. That appeared to be the right temperature for printing, but a bit too high for the hotend. It looked like decreasing the temperature a little was possible. The further experiments proved that printing it at 245C works perfectly fine.

The bed was at 60C and covered by PVA. The attempts to print on clean glass at 75C and 90C were not successful.

The filament behavior appears to be similar to PLA. There’s leaking and fan is likely to be needed for printing small details. In the print pictured below the fan was always on at 30% (mostly because I was hoping it will help to keep the upper part of the hotend from overheating).

alloy910smallparts

After making a few more prints the conclusion is that 50mm/s is too fast for this filament and my Makergear hotends. There was obvious insufficient extrusion of the filament in the infill  printed at 50mm/s regardless of fan being turned on or off and regardless of the printing temperature being increased or decreased 5C. Printing everything at the constant speed of 30mm/s immediately improved the results.

The print on the left picture is done at 50mm/s infill, the right at 30mm/s.

20181216_225311 20181216_232040

December 2, 2018

Printing T-glase clear filament

Filed under: 3D Printing

The material prints nicely. It flows and leaves strings like PLA though (perhaps increasing retraction a bit will help).

I used the same slicer settings as for their (http://taulman3d.com) Nvent filament (didn’t play with any settings to make it more transparent). The extruder was at 245C although I think it could be at a bit lower (240-243 C) temperature to help with stringing. The bed was at 75. For small objects (20 x 20 x 10 mm calibration piece) it worked fine with Elmer’s glue, but the large pieces didn’t stick well enough till printed on the clear glass. I had no troubles removing those large pieces after cooling down (they pretty much got loose on their own).

t-glase-printing 20181202_011456

P.S. I forgot to note what was the fan setting and cannot remember it now (I think I kept it off).

October 4, 2018

How Much Lead Can You Get From a Car Battery

Filed under: General

Long story short, I needed to source about 20lb of lead cheaply and decided to take apart an old car-sized marine battery a friend gave me.

If you ever do that (and my advice don’t) just get the contact points and the big chunks that bridge the plates. You can see the latter on the picture inside the battery case.

Getting the lead mesh from the plates is not worth the efforts. There is more junk there than lead.

Baking soda and/or pool’s PH+ chemicals can be used to neutralize it. Borax can be used too. It converts it into boric acid and anhydrous sodium sulfate (neither of which is a nasty stuff, apparently). The process is simple. First, the water is added to dilute the acid (it’s not pure, so 50/50 mix is good enough). Then the neutralizing agent is added slowly (if doing it start with one spoon to see how it reacts). The baking soda and HTH PH+ bubble when added (borax doesn’t). As soon as it stops bubbling when the baking soda or HTH PH+ is added it should be good to dispose of.

It took quite a bit of the stuff to neutralize all the acid in the bucket and its remains in the battery case. I have scavenged and dumped in a pound or two all the above chemicals till it finally stopped bubbling.

20180915_160845 20180915_160854 20180916_3

The final result: 10lb

20180916_144331

And after smelting there were only about 6lb left.

The conclusion: a lot of time, efforts and baking soda wasted (borax and PH+ did not count, didn’t need them anyway).

Water Purity Experiment

Filed under: Water

Just for the fun of it I decided to see how different is the residue after evaporating the water coming directly from the well, vs passed through the softener, vs passed through the reverse osmosis filter (iSpring under-the-sink system).

I have filled in 3 glasses, covered them with a napkin and left to evaporate slowly in a secluded corner in the basement.

To my surprise it took a while (about 2-3 months, probably due to high humidity in the basement in the summer).

Here are the results (left-to-right: well, softener, filter). The last row is under microscope (4x magnification):
20181003_231623 20181003_231630
20181003_231638 20181003_231642 20181003_231645
20181003_232125 20181003_23214420181003_232213
20181003_234106 20181003_234326 20181003_234424

The filter has (quote) “…¬†Alkaline mineralization filter cartridge with Mineral Stone, Calcite, and Corosex …”. The content inside is of brown/yellow color, so I guess that’s where the brown crystals come from.

Older Posts »


Home

OkOb.net Tips & Tricks Blog
Powered by WordPress