1/03/2023
// Traverses an arbitrary struct and translates all stings it encounters | |
// | |
// I haven't seen an example for reflection traversing an arbitrary struct, so | |
// I want to share this with you. If you encounter any bugs or want to see | |
// another example please comment. | |
// | |
// The MIT License (MIT) | |
// | |
// Copyright (c) 2014 Heye Vöcking | |
// |
github.com/twotwotwo/sorts is a Go package with parallel radix- and quicksorts. It can run up to 5x faster than stdlib sort on the right kind of large sort task, so it could be useful for analysis and indexing/database-y work in which you have to sort millions of items. (To be clear, I don't recommend most folks drop stdlib sort, which is great, and which sorts depends on.)
While the process of writing it's fresh on my mind, here are some technical details, some things that didn't make the cut, and some thoughts about the process:
Concretely, what this looks like inside:
-
Both number and string versions are in-place MSD radix sorts that look at a byte at a time and, once the range being sorted gets down to 128 items, call (essentially) the stdlib's quicksort.
-
The [parallelization code
found at: http://fascinated.fm/post/2379188731/getting-a-motorola-sbg6580-into-bridge-mode-on
Getting a Motorola SBG6580 into “Bridge” mode on TimeWarner Wideband
- Unplug coax cable from Motorola
- Hold down the white reset button on the back panel with a pen for 30s. This resets all settings to factory defaults. The modem will be auto-reconfigured once you plug in the coax cable.
- When modem is back on plug in a computer with an Ethernet cable into the modem.
- Connect to http://192.168.0.1 and login with “admin” / “motorola”
- Now you will make some changes:
- Wireless -> Primary Network -> Disabled
rbackup is a lightweight, rsync-powered backup utility that creates time-stamped backups.
It can save backups to your local filesystem (probably an attached USB device) or to a remote host.
Backups are saved in time-stamped directories. Backups are cheap on storage, because hard-links are used for files that haven't changed between backups.
TLDR: I now add the following snippet to all my Dockerfiles:
# If host is running squid-deb-proxy on port 8000, populate /etc/apt/apt.conf.d/30proxy
# By default, squid-deb-proxy 403s unknown sources, so apt shouldn't proxy ppa.launchpad.net
RUN route -n | awk '/^0.0.0.0/ {print $2}' > /tmp/host_ip.txt
RUN echo "HEAD /" | nc `cat /tmp/host_ip.txt` 8000 | grep squid-deb-proxy \
&& (echo "Acquire::http::Proxy \"http://$(cat /tmp/host_ip.txt):8000\";" > /etc/apt/apt.conf.d/30proxy) \
&& (echo "Acquire::http::Proxy::ppa.launchpad.net DIRECT;" >> /etc/apt/apt.conf.d/30proxy) \
|| echo "No squid-deb-proxy detected on docker host"
function getTrilateration(position1, position2, position3) { | |
var xa = position1.x; | |
var ya = position1.y; | |
var xb = position2.x; | |
var yb = position2.y; | |
var xc = position3.x; | |
var yc = position3.y; | |
var ra = position1.distance; | |
var rb = position2.distance; | |
var rc = position3.distance; |
This script modifies the Haserl 0.9.29 distribution so it works with LuaJIT 2.0 as well as Lua 5.1. The script takes a single argument that is the path to a LuaJIT / Lua distribution directory in which library and executable files have been built. A typical usage is
./build-haserl-luajit.sh /usr/local/src/LuaJIT-2.0.0/
The script patches configure.ac, builds Haserl, and executes a CGI script to verify that LuaJIT / Lua is working within Haserl.
The LuaJIT distribution builds both .so and .a libraries; this script always uses the .a library so the Haserl executable contains an embedded copy of LuaJIT. If you prefer to link dynamically to LuaJIT, modify the script to change
[ LIBS="-Wl,-Bstatic -l$LUALIB -Wl,-Bdynamic $LIBS" ]
- Your class can be no longer than 100 lines of code.
- Your methods can be no longer than five lines of code.
- You can pass no more than four parameters and you can’t just make it one big hash.
- When a call comes into your Rails controller, you can only instantiate one object to do whatever it is that needs to be done. And your view can only know about one instance variable.
You can break these rules if you can talk your pair into agreeing with you.