It means there is a glitch in the matrix - agents are coming!
A piggy bank of commands, fixes, succinct reviews, some mini articles and technical opinions from a (mostly) Perl developer.
Jump to
Note-taking apps for desktop, web and mobile
November 2021
Joplin
- Joplin is pretty great because it syncs between desktop and mobile, using any backend cloud of your choice.
- Joplin doesn't have an official web app, probably because it would be re-inventing the wheel.
- It does have this web client (alternate link), but it's not being maintained.
- It did have nextcloud integration, but this has not been maintained.
- To do: Check those forks too
- Nextcloud can be self-hosted (requires some work), or it can be hosted in the cloud by a provider.
Tomboy
- Tomboy appears very linux-centric, although it has clients for Windows and Mac too.
- It has an Android app, TomDroid.
- It has a WebDAV plugin for publishing to the web
- No web actual app
Evernote
- Proprietary software
- Charges actual money
- Irritating business practices
- Free version only allows two devices, which isn't enough
Org mode
- orgmode.org
- No web app
Colornote
- Works brilliantly on Android
- Super fast for short notes
- No web app
Others
Delete all files except one on linux
Glob
- shopt -s extglob
- rm -v !("filename")
- rm -v !("filename1"|"filename2")
- rm -v !(*.zip|*.odt)
- shopt -u extglob
- find /directory/ -type f -not -name 'PATTERN' -delete
- find /directory/ -type f -not -name 'PATTERN' -print0 | xargs -0 -I {} rm {}
- find /directory/ -type f -not -name 'PATTERN' -print0 | xargs -0 -I {} rm [options] {}
- find . -type f -not \(-name '*gz' -or -name '*odt' -or -name '*.jpg' \) -delete
- cd test
- GLOBIGNORE=*.odt:*.iso:*.txt
- rm -v *
- unset GLOBIGNORE
All the homebrew packages I've installed on Mac OSX
I've used `brew install ....` many times, but now I'm regretting it because:
- `brew update` takes so incredibly long to run, and downloads lots of unnecessary git history
- `/usr/local/Cellar` is 3.8Gb big and I'm short on disk space
- redis@4.0
- watch
- tree
- dnsmasq
- libunistring
- libxmlsec1
- xmlsec1
- ack
- putty
- cmatrix
- the_silver_searcher
- ag
- youtube-dl
- elasticsearch@6.7
- vbindiff
- libpng
- ilmbase
- oniguruma
- jq
- telnet
- gifsicle
- fontconfig
- tidy-html5
- minio
- gcc@4.9
- autoenv # bugged: breaks "cd -"
- direnv
- maven@3.6
- htop-osx
- htop
- xvid
- npm
- node@14
- lsd
- id3v2
- nghttp2
- gnutls
- sphinx-doc
- protobuf@3.17
- markdown
- postgres@13
- ruby
- httrack
- chafa
- wget
- python@3.7
- python2
- coreutils
- ctags-exuberant
- ctags
Folding@Home FAHClient on Mac OSX
Mac [23:49 ~$] pkgutil --file-info /usr/local/bin/FAHClient volume: / path: /usr/local/bin/FAHClient pkgid: org.foldingathome.fahclient.pkg pkg-version: 7.5.1 install-time: 1585049394 uid: 0 gid: 0 mode: 755 Mac [23:50 ~$] pkgutil --files org.foldingathome.fahclient.pkg Applications Applications/Folding@home Applications/Folding@home/Web Control.url Library Library/LaunchDaemons Library/LaunchDaemons/org.foldingathome.fahclient.plist usr usr/local usr/local/bin usr/local/bin/FAHClient usr/local/bin/FAHCoreWrapper
How to install libxmlsec1 via Alien::LibXMLSec on Mac OSX
- Make sure openssl is installed
- Download Alien::LibXMLSec (it's not on CPAN)
- Unzip it & change to dir
- perl Makefile.PL
- PKG_CONFIG_PATH=/usr/local/Cellar/openssl@1.1/1.1.1k/lib/pkgconfig make
- make
- make install
- git clone Alien::Build from its git repo
- do a `dzil build` on that
- then set the PERL5LIB to point to the built instance of Alien::Build
- ...and also make sure its deps are in PERL5LIB.
How to install DBD::Pg Perl module on Mac OSX
How to use dbdeployer to easily deploy multiple versions of MySQL for testing
Download dbdeployer, it is awesome.
Caveat: For best results, you should have a recent version of your operating system installed.
dbdeployer cheat sheet
export PATH=/path/to/dbdeployer:$PATH
dbdeployer downloads tree --flavour mysql --OS linux
dbdeployer downloads get-unpack [filename here]
dbdeployer deploy single 8.0.22
dbdeployer sandboxes
dbdeployer use msb_8_0_22
dbdeployer sandboxes --full-info
Working with dbdeployer
~/sandboxes/msb_8_0_22/metadata socket
Idea: Automated testing of database schema design
When writing or maintaining a MySQL database schema, there are a number quality checks that could conceivably be automated:
- Run the test suite and print out all the SQL statements it runs (e.g. for Perl set DBIC_TRACE=1). Now check that every column mentioned in a `where` clause has an index on it.
- Indexes are defined by: `KEY` or `UNIQUE` next to them
- Indexes are probably most important on large data tables, so identify those manually.
Parse a Perl stack trace for ease of understanding
Problem:
A Perl stack track is difficult to parse with my inferior human brain; I want to align each line horizontally so that discrepancies jump out at me.
Solution:
This isn't the whole solution, but it goes some way towards it.
perl script.pl | grep -v ^eval | perl -plne'$len=300-length($_); $space=" "x$len; s/called at /${space}called at /'
Type GBP symbol without numeric keypad
Full size keyboard numpad method
If you have a numeric keypad to the right of you keyboard, you can type Alt+0163 to get a UK pound sterling symbol on a US-keyboard.
Modern laptop numpad method
Some laptops use a Fn (function) key and overlay the numpad on the main keyboard - so on a Dell Latitude I can hold Alt+Fn and type MJOL (which corresponds to 0163) to get a £ symbol.
...but some modern laptops don't have a numeric keypad at all. For those situations, see below.
Keyboard language switch
Install a UK keyboard alongside the US keyboard in control panel, and then type Win+Space to switch between them. Probably Windows 10 only.
Shift-3 usually types a # (hashtag) when set to US keyboard, and a £ (pound sterling) when set to UK keyboard.
Windows 10 character map (May 2019 update)
Type Win+. (dot) and you'll get a character map with all the symbols you'll ever need! 😊
It even remembers the ones you've used recently for quick access. (❁´◡`❁)
For faster keyboard navigation you can press [Tab] to cycle through the controls and [Enter] to select.
Old Windows method
Open the character map application from the start menu. You can search for it in the latest Windows, or it may be hidden in the Accessories folder for older versions.
Perl one-liner to decode JSON
cat file.json | sed 's/\/\/.\+//' | perl -MData::Dumper::Concise -MJSON -n0777 -E '$r = decode_json($_); say Dumper($r)'
Quick guide: How to set up MySQL and PostgreSQL databases for Perl development
# The following means mysql is not running:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
MySQL
INSTALL
sudo apt install -y libmysqlclient-dev mysql-client mysql-server
START
$ sudo service mysql start
SETUP
CREATE USER zaphod;
ALTER USER 'zaphod'@'%' IDENTIFIED BY 'some_pass';
GRANT ALL PRIVILEGES ON *.* TO 'zaphod'@'%'; -- makes zaphod an admin
FLUSH PRIVILEGES;
ACCESS
$ mysql -u zaphod -D some_db -p
ADMIN ACCESS
$ sudo mysql
PostgreSQL
INSTALL
sudo apt install -y postgresql libpq-dev
START
$ sudo service postgresql start
SETUP
create user zaphod;
\password zaphod
create database some_db;
grant all privileges on database some_db to zaphod;
ACCESS
$ psql -U zaphod -h localhost -d some_db
# specifying the host forces md5 (password) authentication. Otherwise default is "peer"
ADMIN ACCESS
$ sudo su postgres
$ psql
Enforce safe search
Instructions for how to enforce safe search on all the search engines:
- https://support.google.com/
websearch/answer/186669 (force safesearch.google.com) - https://help.bing.microsoft.
com/#apex/18/en-US/10003/0 (st rict.bing.com) - https://support.google.com/a/
answer/6214622 (restrict. youtube.com) - https://help.duckduckgo.com/
duckduckgo-help-pages/ features/safe-search/ (safe. duckduckgo.com) - https://yandex.com/support/
search/schoolsearch.html# schoolsearch (familysearch. yandex.ru)
- https://protectyoungeyes.com/
how-to-block-porn-on-any- device-for-free/ - https://docs.paloaltonetworks.
com/pan-os/7-1/pan-os-admin/ url-filtering/safe-search- enforcement - https://support.opendns.com/
hc/en-us/articles/227986807- How-to-Enforcing-Google- SafeSearch-YouTube-and-Bing - https://support.opendns.com/
hc/en-us/articles/228006487- FamilyShield-Router- Configuration-Instructions - https://www.reddit.com/r/
duckduckgo/comments/8qwzyl/ feature_request_allow_network_ operators_for_force/