Skip to content. | Skip to navigation

Personal tools
Log in
Sections
You are here: Home

jorgenmodin.net - Blog

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

Convert hex or base64 to binary on the Linux command line

Posted by admin |

base64:

base64 -d infile.base64 > outfile.bin

hex (untested):

xxd -r -p input.txt output.bin

https://stackoverflow.com/questions/7826526/transform-a-hex-info-to-binary-using-linux-command

Apr 19, 2018 06:27

The IT guy

Posted by admin |

I have met a few IT guys who sound pretty much like this. Often very knowledgeable in their field, but sometimes difficult to get to work fruitfully in a bigger context.

Apr 08, 2018 04:03

Legal/IT pioneers whose names I have problems remembering

Posted by admin |

In the spirit of using this blog also as my notepad:

 

  • Eben Moglen
  • Lawrence Lessig

 

And some keywords so I can find them again:

EFF, Electronic frontier foundation, law, cyberspace. Columbia, Stanford.

Mar 28, 2018 08:53

How to use locate on an encrypted home directory

Posted by admin |

Use a separate db for the encrypted part, and store that db on that encrypted part. A complete working solution with safeguards for not running when on battery or when the directory is encrypted, is linked below:

Read more: Link - tolaris.com · Secure locate with ecryptfs, part 2

Mar 14, 2018 10:45

Yopass - an attempt to more securely share secrets

Posted by admin |

Seems to be about expiring urls and some encryption. Demo here: https://yopass.se/

Mar 12, 2018 10:58

Setting up 2 factor authentication for ssh logins on Ubuntu 16.04

Posted by admin |

totp may be deployed so you can use your Google Authenticator, FreeOTP or similar, to add a layer of security to your ssh logins.

This guide worked for me (Linode):

Use One-Time Passwords for Two-Factor Authentication with SSH on Ubuntu 16.04 and Debian 8

While this guide did not enable totp for me:

https://www.digitalocean.com/community/tutorials/how-to-set-up-multi-factor-authentication-for-ssh-on-ubuntu-16-04

 

Mar 04, 2018 05:30