IT notes

letsencrypt + cloudfare using DNS

It’s not necessary to disable CloudFlare to use Let’s Encrypt, Installation: On mac os X: $ git clone https://github.com/lukas2511/letsencrypt.sh $ cd letsencrypt.sh $ mkdir hooks $ git clone https://github.com/kappataumu/letsencrypt-cloudflare-hook hooks/cloudflare $ pip install -r hooks/cloudflare/requirements-python-2.txt Configuration Your account’s CloudFlare email and API key are expected to be in the environment: $ export CF_EMAIL="[email protected]" $ export CF_KEY="Global API Key" $ export CF_DNS_SERVERS='8.8.8.8 8.8.4.4' Usage $ ./letsencrypt.sh -c -d imap.ejemplo.org -t dns-01 -k "hooks/cloudflare/hook.py" # # !!

error loading certificates pkg freebsd

On an FreeBSD 9 while trying to install python or something else via pkg you may get this: > pkg search python pkg: Repository FreeBSD missing. 'pkg update' required pkg: Error loading trusted certificates pkg: Error loading trusted certificates pkg: Repository FreeBSD cannot be opened. 'pkg update' required To solve it, fetch the current official repository key: mkdir -p /usr/share/keys/pkg/trusted /usr/share/keys/pkg/revoked svn export https://svn0.us-west.FreeBSD.org/base/head/share/keys/pkg/trusted/pkg.freebsd.org.2013102301 /usr/share/keys/pkg/trusted/ Then set the repo: FreeBSD: { url: "pkg+http://pkg.FreeBSD.org/${ABI}/latest", mirror_type: "srv", signature_type: "fingerprints", fingerprints: "/usr/share/keys/pkg", enabled: yes } Next, running pkg udpate should work: $ pkg update Updating FreeBSD repository catalogue...

/bin/sh shell set

The Bourne shell (sh) is a shell, or command-line interpreter, for computer operating systems. The Bourne shell was the default shell for Unix Version 7. Most Unix-like systems continue to have /bin/sh—which will be the Bourne shell, or a symbolic link or hard link to a compatible shell even when other shells are used by most users. https://en.wikipedia.org/wiki/Bourne_shell set options In sh, the set built-in command has the following options: option Description – An option of a double-dash (“–”) signifies the end of an option list.

mosh

mosh (mobile shell) Remote terminal application that allows roaming, supports intermittent connectivity, and provides intelligent local echo and line editing of user keystrokes. Mosh is a replacement for SSH. It’s more robust and responsive, especially over Wi-Fi, cellular, and long-distance links. How to install server FreeBSD: $ pkg install net/mosh Edit /etc/login.conf and add this to the default: :charset=UTF-8:\ :lang=en_US.UTF-8:\ :setenv=LC_COLLATE=C: After editing /etc/locing.conf run: $ cap_mkdb /etc/login.conf Client In a mac OS X; $ brew install mobile-shell How to use Basically just type mosh instead of ssh, Mosh will log the user in via SSH, then start a connection on a UDP port between 60000 and 61000., Mosh will log the user in via SSH, then start a connection on a UDP port between 60000 and 61000.

Why is unit testing important?

Why is unit testing important? Short answer, to avoid something like this: The links are inverted Because of that error, people may not be available to download or install the proper app and therefore will lost credibility of the service. What is Unit Testing? In computer programming, unit testing is a software testing method by which individual units of source code, sets of one or more computer program modules together with associated control data, usage procedures, and operating procedures, are tested to determine whether they are fit for use.

vim

Quote/unquote words: ciw'Ctrl+r"' or ciw '' Esc p p paste after the cursor, P will paste before the cursor. Search matches (gn with the dot command) Suppose that we have a document containing several occurrences of the word ‘Normal’ and we’d like to change each occurrence to ‘Visual’. We can run /Normal to search for the word ‘Normal’, then type cgnVisual<Esc> to change the next match to the word ‘Visual’ and by pressing .

brew macos

Homebrew installs the stuff you need that Apple didn’t. For example to update python and avoid many SSL warnings: brew install python To use an updated version of git on mac use: brew install git --whitout-completion To update vim: brew install vim --with-override-system-vi Updating zsh: # check the zsh info brew info zsh # install zsh brew install zsh # add shell path sudo vim /etc/shells # add the following

asciinema

asciinema [as-kee-nuh-muh] is a free and open source solution for recording terminal sessions and sharing them on the web. Install FreeBSD: pkg install asciiname OS X: brew update && brew install asciinema Recording tmux session Setup your tmux session create windows, splits, start processes in them: tmux new -s session-name Detach (prefix+d) and start recording with: asciinema rec -c "tmux attach -t 0" /tmp/play.json When you’re finished, just detach the

virtualbox-el-capitan

When trying to install Virtualbox in OS X El capitan you may notice it hangs at Verifying “VirtualBox.pkg”. You can by pass the warning trying to install via command line with: $ sudo installer -package /Volumes/VirtualBox/VirtualBox.pkg -target /

Simulate cron environment

Add this to your cron: * * * * * env > ~/cronenv Then start a new shell using does environments: env - `cat ~/cronenv` /bin/sh