PV does everything.
root@mlll2664:~# pv -tpreb /dev/sdc | dd of=/dev/sdd bs=512M 27.5GB 0:03:28 [ 130MB/s] [========> ] 12% ETA 0:24:39
You can also funnel this into the dialog tool and make it visual:

See here for more details.
PV does everything.
root@mlll2664:~# pv -tpreb /dev/sdc | dd of=/dev/sdd bs=512M 27.5GB 0:03:28 [ 130MB/s] [========> ] 12% ETA 0:24:39
You can also funnel this into the dialog tool and make it visual:

See here for more details.
$ echo "cleartext" | gpg --passphrase "some-passphrase" -c --no-use-agent > text.encrypted
$ cat text.encrypted | gpg --passphrase "passphrase" --no-use-agent 2>/dev/null
$ cat text.encrypted | gpg --passphrase "some-passphrase" --no-use-agent 2>/dev/null
cleartext
Without “–no-use-agent”, you might very well be prompted by some system keyring/agent every time.
int i = (0, 1, 2, 3, 4, 5); int j = (a2d_init(), a2d_fetchvalue());
Setting-up the coloredlogs package is easy. Just install the coloredlogs package from PIP, import coloredlogs, and initialize like the following:
coloredlogs.install(isatty=True)
Note the isatty parameter. By default, coloredlogs detects whether or not you’re in a terminal and enabled ANSI output accordingly. This means that you won’t see ANSI output in Jenkins unless you explicitly pass True.
Make sure to check “Color ANSI Console Output” in your job config. Using “xterm” for “ANSI color map” worked fine for me.
As this will add another handler to the logging, you may see duplicate logging if you have any other handlers.
For more information on configuration, see the documentation.
You can also use this for the VPN. Occasionally my taskbar freezes on one of my laptops, so this is a contingency to start my VPN if that is happening at the time.
$ nmcli con up id "ML (east)"
There is an unlisted subcommand to apt-cache called “madison”. This will simply list all available versions:
$ apt-cache madison git git | 1:2.11.0-2~ppa0~ubuntu14.04.1 | http://ppa.launchpad.net/git-core/ppa/ubuntu/ trusty/main amd64 Packages git | 1:1.9.1-1ubuntu0.3 | http://us.archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages git | 1:1.9.1-1ubuntu0.3 | http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages git | 1:1.9.1-1 | http://us.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages git | 1:1.9.1-1 | http://us.archive.ubuntu.com/ubuntu/ trusty/main Sources git | 1:1.9.1-1ubuntu0.3 | http://us.archive.ubuntu.com/ubuntu/ trusty-updates/main Sources git | 1:1.9.1-1ubuntu0.3 | http://security.ubuntu.com/ubuntu/ trusty-security/main Sources
In all likelihood this will work under Debian, too.
I am specifically using Ubuntu, but it does not matter as long as you have the xinput tool installed.
At the command-line, run xinput --list to list all of your HID devices:
$ xinput --list
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ SynPS/2 Synaptics TouchPad id=13 [slave pointer (2)]
⎜ ↳ eGalax Inc. eGalaxTouch EXC7910-1026-13.00.00 id=10 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ Power Button id=6 [slave keyboard (3)]
↳ Video Bus id=7 [slave keyboard (3)]
↳ Sleep Button id=8 [slave keyboard (3)]
↳ Lenovo EasyCamera id=9 [slave keyboard (3)]
↳ Ideapad extra buttons id=11 [slave keyboard (3)]
Identify the ID of the one that corresponds to your screen. Disable it:
$ sudo xinput disable 10 [sudo] password for dustin:
To make the change permanent, add the second command to a script in /etc/X11/Xsession.d (e.g. “98disablexinput”):
#!/usr/bin/bash xinput disable 10
A space-filling curve (SFC) is, essentially, a line that bends through a space and hits every point. It was made possible by a proof created by Georg Cantor in the late 1800s. You can then map a coordinate in N-dimensions on to it to determine a single, identifying, scalar index. Google’s S2 library uses a specific SFC called a Hilbert curve (which is a fractal) and some other tricks to map geographic coordinates to a single 64-bit integer. This has the characteristic of assigning any coordinate within the same locality a very similar index; the closer the points are, the more of the prefix will be the same. Indeed, the difference between one SFC and another is, physically, how the curve bends and, ultimately, how it preserves locality. Hilbert is most popular for this though it is not the simplest SFC. For a list of various curves, look in the “See also” section of the Wikipedia page. Each of those references shows illustrations of what the curves look like.
As far as the index produced by S2, you can compare smaller, finer areas and larger, rougher areas by comparing a larger prefix or a smaller prefix, respectively. This not only allows you to easily search an index for places in a specific area but to also implicitly determine if one area contains another.
If you are interested in the mechanics of S2 (the Go version), the mapping magic happens in the following progression.
First, convert the LatLng to a Point (which just encapsulates a vector type provided by the R3 sibling project for three-dimensional coordinate systems):
func PointFromLatLng(ll LatLng) Point {
phi := ll.Lat.Radians()
theta := ll.Lng.Radians()
cosphi := math.Cos(phi)
return Point{r3.Vector{math.Cos(theta) * cosphi, math.Sin(theta) * cosphi, math.Sin(phi)}}
}
Second, convert the Point to face coordinates:
func cellIDFromPoint(p Point) CellID {
f, u, v := xyzToFaceUV(r3.Vector{p.X, p.Y, p.Z})
i := stToIJ(uvToST(u))
j := stToIJ(uvToST(v))
return cellIDFromFaceIJ(f, i, j)
}
Third, convert the face coordinates to the one-dimensional index (a 64-bit integer aliased as the CellID type):
func cellIDFromFaceIJ(f, i, j int) CellID {
// Note that this value gets shifted one bit to the left at the end
// of the function.
n := uint64(f) <= 0; k-- {
mask := (1 <>uint(k*lookupBits))&mask) <>uint(k*lookupBits))&mask) <>2) << (uint(k) * 2 * lookupBits)
bits &= (swapMask | invertMask)
}
return CellID(n*2 + 1)
}
There is also the function that allows you to step along the curve, which is very inexpensive:
func (ci CellID) AdvanceWrap(steps int64) CellID {
if steps == 0 {
return ci
}
// We clamp the number of steps if necessary to ensure that we do not
// advance past the End() or before the Begin() of this level.
shift := uint(2*(maxLevel-ci.Level()) + 1)
if steps > shift); steps > shift)
steps %= wrap
if steps > shift); steps > max {
wrap := int64(wrapOffset >> shift)
steps %= wrap
if steps > max {
steps -= wrap
}
}
}
// If steps is negative, then shifting it left has undefined behavior.
// Cast to uint64 for a 2's complement answer.
return CellID(uint64(ci) + (uint64(steps) << shift))
}
The S2 project has its own Hilbert implementation. To see an implementation that excludes all of the sphere mechanics (the presence of which makes things considerably more complicated), see Google’s hilbert (Go implementation) project.
Space-filling functions are a fantastically-useful method for clustering anything that you might have a requirement for, though you might need a mathematician to come up with a process to adjust your coordinates if they are not initially acceptable as inputs (the qualification of which might also require said mathematician). Also, SFCs are non-injective: The index that you get is not necessarily unique for any two coordinates, though, in such a situation, you are guaranteed that two coordinates resulting in an identical index would basically have to be very similar themselves (the accuracy of this depends on which SFC you use).
For reference, there also exists a reversible geographic-to-string conversion library called Geohash (also here). However, this does not use SFCs and, I believe, suffers from distortion either over the equator or for great distances though I am having trouble finding where I saw that, just now. The Hilbert/S2 approach does not have this problem.
Google’s S2, geometry on the sphere, cells and Hilbert curve (great article)
Peano curve (the first known space-filling curve)
Analysis of the Clustering Properties of Hilbert Space-filling Curve (paper)
Mapping N-dimensional value to a point on Hilbert curve (SO)
S2 (Go package)
If you know the set of things that you’re going to be hashing, then you can hash without collisions:
Minimal Perfect Hashing
Throw away the keys: Easy, Minimal Perfect Hashing
Perfect hash function
It basically involves implementing our own net.Listener and monitoring a channel.
You must be logged in to post a comment.