UV Cheat Sheet incorporating the latest tips and tricks from the official UV documentation:
Install UV using the official standalone installer:
macOS and Linux:
UV Cheat Sheet incorporating the latest tips and tricks from the official UV documentation:
Install UV using the official standalone installer:
macOS and Linux:
# Include this in your .bashrc: | |
function activate_virtualenv () { | |
[[ -n $VIRTUAL_ENV ]] && deactivate; | |
venv=`python3 ~/.find_venv.py .`; | |
[[ ! -z "$venv" ]] && . $venv/bin/activate; | |
return 0 | |
} | |
function cd () { |
#!/usr/bin/env python3 | |
# update_ip.py - A script for updating dynamic DNS using Opalstack's API | |
# by Chad von Nau | |
# | |
# * Python 2 and 3 compatible. | |
# * Supports IPv4 and IPv6 addresses. | |
# * Records the last IP in a JSON file and only calls the API if the IP has changed. | |
# | |
# Instructions: |
The man doveadm-sync
pages are cryptic and not very well explained, as well they are missing quality real-world examples.
This gist aims to give some clarity and explanation.
Here is the command I got to successfully transfer (and sync backwards too) an email account from an old Dovecot email server to a new Dovecot email server:
To my knowledge, both servers must have a matching account already setup for this to work:
Sometimes it is really nice to just take a quick look at some data. However, when working on remote computers, it is a bit of a burden to move data files to a local computer to create a plot in something like R
. One solution is to use gnuplot
and make a quick plot that is rendered in the terminal. It isn't very pretty by default, but it gets the job done quickly and easily. There are also advanced gnuplot
capabilities that aren't covered here at all.
gnuplot
has it's own internal syntax that can be fed in as a script, which I won't get into. Here is the very simplified gnuplot
code we'll be using:
set terminal dumb size 120, 30; set autoscale; plot '-' using 1:3 with lines notitle
Let's break this down:
So, let’s flip a coin: if it’s heads, play a drum, if it’s tails, play a cymbal. Easy. We can emulate a coin flip with our one_in function (introduced in the section on randomness) specifying a probability of 1 in 2: one_in(2). We can then use the result of this to decide between two pieces of code, the code to play the drum and the code to play the cymbal: | |
loop do | |
if one_in(2) | |
sample :drum_heavy_kick | |
else | |
sample :drum_cymbal_closed | |
end | |
$ wp post list --format=ids | xargs wp post update --comment_status=closed | |
# Output: | |
# Success: Updated post 2514. | |
# Success: Updated post 2511. | |
# Success: Updated post 2504. | |
# Success: Updated post 2499. | |
# Success: Updated post 2441. | |
# etc... |
-- | |
-- gist support for launchbar | |
-- 1. install gist client "sudo gem install gist" | |
-- https://github.com/defunkt/gist | |
-- 2. login "gist --login" | |
-- | |
-- use from launchbar as file action, string/search action, or | |
-- plain action (will take text from clipboard) | |
-- then will put gist url as launchbar result | |
-- from there you can Copy it or hit Enter to open in browser |
Answer by Jim Dennis on Stack Overflow question http://stackoverflow.com/questions/1218390/what-is-your-most-productive-shortcut-with-vim/1220118#1220118
Your problem with Vim is that you don't grok vi.
You mention cutting with yy and complain that you almost never want to cut whole lines. In fact programmers, editing source code, very often want to work on whole lines, ranges of lines and blocks of code. However, yy is only one of many way to yank text into the anonymous copy buffer (or "register" as it's called in vi).
The "Zen" of vi is that you're speaking a language. The initial y is a verb. The statement yy is a simple statement which is, essentially, an abbreviation for 0 y$:
0 go to the beginning of this line. y yank from here (up to where?)