Notes about using the vim editor, especially useful regular expressions (regex, regexes).
-
:g/
pattern
/.!
command
It's important that the dot command (
.
) appear between the search pattern and the bang (!
) beginning the external command.
Example of GitHub's geoJSON support |
Preferences for Auto Text Expander ℹ️👍😃 |
If ntpdate
is installed:
sudo ntpdate pool.ntp.org
To install ntpdate
:
sudo apt-get install ntpdate # for Ubuntu-like
r"""Command-line tool to validate and pretty-print JSON | |
Usage:: | |
$ echo '{"json":"obj"}' | python -m json.tool | |
{ | |
"json": "obj" | |
} | |
$ echo '{ 1.2:3.4}' | python -m json.tool | |
Expecting property name enclosed in double quotes: line 1 column 3 (char 2) |
#!/bin/sh -- | |
# Save as "git-exclude" and set the executable flag. | |
# Execute as "git exclude repo_path file_path" | |
if [ $# -ne 2 ]; then | |
echo "usage: $(basename $0 | sed 's/-/ /g') <repo-dir> <file-path>" > /dev/stderr | |
exit $(false) | |
fi |
#!/bin/bash -- | |
# File containing the process ID of the application, written by the application | |
PID_FILE='app.pid' | |
# The process name or some string unique to the application's process | |
PROCESS_NAME="java -Dspring.config.location=${HOME}/application.properties" | |
[[ $# -gt 0 && $1 = '-v' ]] && VERBOSE=1 |
There are times notifications aren't wanted about either a changed repo file or a new file that needs to be added to the repo. However, adding the name of the file to .gitignore
might not be a good option, either. For example, locally-generated files that other users aren't likely to generate (e.g., files created by an editor) or files of experimental test code might not be appropriate to appear in a .gitignore
file.
In those cases, use one of these solutions:
If the file is a changed repo file
Use the command:
git update-index --assume-unchanged "$FILE"
# Standalone mini version of pip | |
# Geared towards Pythonista, but easily adaptable to other pure python installs | |
import argparse, copy, gzip, os, os.path, re, requests, shutil, site, sys, tarfile, time, xmlrpclib | |
# Where packages will end up installed | |
site_packages = site.USER_SITE | |
# Root of Pythonista saveable document location | |
pythonista_base = os.path.split(site_packages)[0] | |
# Temporary directory for work |