Skip to content. | Skip to navigation

Personal tools
Log in
Sections
You are here: Home

jorgenmodin.net - Blog

It seems I've finally left Sublime for VS Code and Atom

Posted by admin |

I don't remember what it was now, but there was a piece of functionality I could get in VS Code and not in Sublime, and it made me switch. Recently I have been working with s-expressions so I have used Atom for that, since Atom has better integration of Parinfer than VS Code has (same guy doing the plugin for both).

Both Microsoft's VS Code and GitHub's Atom are built on top of Electron, which is basically a version of Google Chrome made to be an application platform.

Jun 17, 2018 11:08

Me talking at events the last month

Posted by admin |

Swedish Land Registry and Blockchain event June 11

demo20180611
Click to view full-size image…
Size: 904.5 kB

WechatIMG9
Click to view full-size image…

Bloxpo event in May ­— presentation of Chromapolis

 

Jun 14, 2018 01:09

Two step keyboard shortcuts are actually pretty nice

Posted by admin |

Summary: In the Atom editor, you can do ctrl+k and then another ctrl+character thingy, or jusr ctrl+k and another character. And that effectively triples the shortcuts and is kind of easy to do.

Edit 2018-06-05: This holds true for VS code too

I needed to use the Atom editor for its Lisp support (which VS code seems to lack, Edit 2018-06-05: VS code actually has parinfer too, Edit 2018-06-12 but it is inferior, maintained by the same guy & he focuses more on the Atom parinfer plugin) and I needed to uppercase some things, and there was no shortcut in the menu for it. I opened the shortcut setting and found that is reachable by

ctrl-k ctrl-u

It seems that ctrl-k works as a mode to put in a "subcommand" similar to screen where ctrl-a does that. It worked surpisingly well. However Atom does not list the shortcut next to the menu option, which kind of defeats or at least hampers the purpose.

 

 

May 23, 2018 04:20

Watermarking a video with ffmpeg

Posted by admin |

Centered overlay/watermark:

ffmpeg -i original-video.m4v -i watermark.png -filter_complex "overlay=x=(main_w-overlay_w)/2:y=(main_h-overlay_h)/2" watermarked-video.m4

See:

https://gist.github.com/bennylope/d5d6029fb63648582fed2367ae23cfd6

May 17, 2018 05:26

Linux Ubuntu 18.04 screen cast software that worked: vokoscreen

Posted by admin |

Linux screen cast software that worked: vokoscreen (although sound had problems in the beginning & uncompressed capture did not work).
Didn't work: kazam (crashed computer, made orange into green).
Worked but no free area capture: gtk-recordmydesktop
All available via apt install on ubuntu 18.04LTS

May 15, 2018 12:15

Meetup.com's strange UI devolvement

Posted by admin |

I do not know how big of an operation meetup.com is, but it seems clear to me that they do not employ a front-end developer normally, but probably just takes one in for a couple hours per year.

A new look has been launched some time ago that has removed all possibilities to format text for meetups, and just today I noticed that if you post a long comment, it will simply say that your post is too long and ask you to try again.

It used to say, even after the UI remake,  that your comment is too long together with info on what is the max amount of characters. That has now been removed. I'm baffled as to why they do not pay more attention their UI.

Also now, you cannot see all participants of a meetup, if it is more than eight. Well, as an admin you can by clicking an obscure link. It's like things just fall by the wayside.

May 12, 2018 04:05

How I got OpenVPN to work on Ubuntu 18.04LTS after sleep/suspend

Posted by admin |

These are preliminary results, it seems to work.

Summary

Switch in the update-resolv-conf from here https://github.com/masterkorp/openvpn-update-resolv-conf/blob/master/update-resolv-conf.sh

and install openresolv

sudo apt install openresolv
  • reboot

The original update-resolv-conf distributed with the openvpn package in Ubuntu 18.04 did not work for me:

https://packages.ubuntu.com/xenial-updates/openvpn

Or, it could possibly be that openresolv resolved the problem of update-resolv-conf not exiting cleanly. I haven't bothered yet to check which of these two changes made the difference, but I suspect it is update-resolv-conf.

Longer text

I could not get systemd to reliably start OpenVPN, especially not after sleep. Restarting OpenVPN after sleep, through systemd, made OpenVPN work every second time. Every odd time (including time number 1) it complained about the up and down scripts not exiting cleanly:

"WARNING: Failed running command (--up/--down): external program did not exit normally"

I resorted to starting the vpn from the command line, same problem, so systemd is not at fault here.

The new update-resolv-conf script I use has this at the end:

# Workaround / jm@epiclabs.io 
# force exit with no errors. Due to an apparent conflict with the Network Manager
# $RESOLVCONF sometimes exits with error code 6 even though it has performed the
# action correctly and OpenVPN shuts down.
exit 0

Who knows, maybe that is all that was needed?

 

May 10, 2018 04:35

How to make curl be curt, but still output error messages such as timeout

Posted by admin |

I needed to continuously check if a service was working, both checking for the response code from it and checking whether it replied at all. I used the shell "watch" command together with curl.

I silenced curl with "-s" in order to not see the progress bar, but still get the result. However that also silenced error messages. It turns out you need "-S" (capital S) to unsilence error messages.

watch curl -s -S http://foo.example.com

Incidentally, "http://example.com" returns a web page on my machine. Hence the "foo" subdomain.

-s Silent or quiet mode. Don't show progress meter or error messages. Makes Curl mute. -S When used with -s it makes curl show an error message if it fails.

Read more: Link - Making curl send errors to stderr and everything else to stdout - Stack Overflow

May 06, 2018 11:15

Systemd and openvpn on Ubuntu 18.04

Posted by admin |

The below link is for 16.04 but seems to work for 18.04 too. My takeaways:

  • There is an /etc/default directory where you can edit the openvpn service to start the desired connection by default (tested)
  • There is an edit command for the systemd's systemctl (untested)

Read more: Link - Correct way of systemd for OpenVPN client on 16.04 Server? - Ask Ubuntu

May 05, 2018 10:14

Python 2.7 UnicodeDecodeError upgrading to Ubuntu 18.04 LTS

Posted by admin |

Summary

Use

import sys
reload(sys) 
sys.setdefaultencoding('utf8')

Longer explanation (or at least more text)

A python script stopped working when upgrading from Ubuntu 17.10 to 18.04LTS. It was still running under python 2.7 but it now had the dreaded UnicodeDecodeError. Why?

Well, who knows, but a possibilty is that Ubuntu has stopped setting a default encoding. The solution is as above.

from __future__ import unicode_literals

…did not work since that made things such as

d.isoformat(' ')

 

stop working complaining about there being unicode.

 

May 03, 2018 07:39