Things
So uwsgi is pretty crazy:
# ./bin/uwsgi --help|wc -l
857
I'm using it under runit to manage some graphite processes, the problem I was having, was that I simply couldn't get it to restart with sv t
, or stop with sv d
.
Turns out, this is because UWSGI's default behaviour is to "brutally reload" when it receives the TERM signal, unlike most other things you'd use under runit which would normally die.
Luckily, one of uwsgi's 857 options fixes this:
So you've got two boxes, separated by some kind of network that you're not in control of, and you'd like to encrypt traffic between them. You're not going to have multiple clients connecting to each other, just these two boxes.
As of OpenVPN 2, it's possible to configure the hosts in peer-to-peer mode, with static keying, meaning that the actual VPN setup is super easy:
- Install OpenVPN (>=2) on both boxes, the standard Wheezy version is fine.
- Generate a static key as follows:
openvpn --genkey --secret /path/to/somewhere/secret.key
- Copy the secret key to both boxes over a secure channel (e.g SSH)
- Create /etc/openvpn/p2p.conf on both boxes as show in box1.vpn.cnf and box2.vpn.cnf below
I've recently struggled to get the following two pieces of DVB hardware to work together on the same machine:
The instructions below apply to Debian Wheezy (7.0) with the [wheezy-backports][wb] repository enabled
The problem is this: Linux 3.2 (available from [wheezy-backports][wb]) comes with a [driver][em28xx] which works fine for the DVB-S2 USB stick, but doesn't come with any drivers at all for the TBS6280 (they
For some reason, this didn't work with the standard GUI bluetooth tools, so I did the following
- Run the command-line bluetoothctl tool
- type "agent on"
- type "scan on"
- press the button on your keyboard, the light should flash if it's not paired with anything else
- type "devices" (this shows the list of devices)
- type "trust xxxx" where xxxx is the keyboard MAC
- type "connect xxxx" where xxxx is the keyboard MAC
- type "pair xxxx" where xxxx is the keyboard MAC
#!/usr/bin/env ruby1.9.1 | |
# encoding:utf-8 | |
# | |
require 'ostruct' | |
require 'optparse' | |
vm = OpenStruct.new {} | |
vm.memory = 1 | |
vm.cpu = 1 |
#!/usr/bin/env ruby | |
require 'maildir' | |
class Maildir | |
def subdirectories | |
dirs = Dir.glob(File.join(@path,"*")).find_all{|a|File.directory?(a)} | |
dirs.map{|a|Maildir.new(a)} | |
end | |
def read_all! |
#!/usr/bin/env ruby | |
DISKS = %w(/ /something /somewhere/else) | |
DISKS.each do |d| | |
(fs,blocks,used,available,cap,mount) = %x[df -P #{d}].lines.drop(1).first.split | |
cap = cap.to_i | |
puts "alert on #{fs} at #{mount} (#{cap}%)" if cap > 85 | |
end |
#!/usr/bin/env ruby1.8 | |
# Alert about available gem updates | |
require 'mauve/sender' | |
require 'mauve/proto' | |
require 'mauve/mauve_time' | |
require 'rubygems' | |
require 'gems' |
#!/usr/bin/env ruby1.9 | |
# Sorts a bunch of lines like this: | |
# Redirect 301 /foo/bar http://stuff | |
# Redirect 301 /foo/bar/baz/ http://stuff | |
# in a way that means that the more-specific paths appear before the | |
# shorter ones, with some intelligence. | |
require 'set' | |
class Redirect |