Skip to content

Instantly share code, notes, and snippets.

View doismellburning's full-sized avatar
🔥

Kristian Glass doismellburning

🔥
View GitHub Profile
@doismellburning
doismellburning / gist:9307715
Created March 2, 2014 14:55
Odd `int foo() {}` warning when running `cabal configure`
$ # https://github.com/doismellburning/lux
$ make
cabal configure --enable-tests
Resolving dependencies...
Configuring lux-0.1.0.0...
/tmp/66923.c:1:12:
warning: control reaches end of non-void function [-Wreturn-type]
int foo() {}
^

I have a pfSense box I want to do fairly simple (I believe) outbound NAT, akin to a home router. It seems I'm mostly there but not quite.

Behaviour

  • There exists an upstream-accessible IP address (lets use 8.8.8.8 for this example)
  • The pfSense box gets assigned an IP address via DHCP on the WAN interface
  • The pfSense box can ping 8.8.8.8
  • A laptop connected to the LAN interface on the pfSense box gets correctly assigned an IP address by DHCP
  • Said laptop can ping the pfSense box
  • Said laptop gets a default route pointing to the pfSense box

Cantab Spam

I got the below spam, to my (probably fairly un-distributed) @cantab.net address on 11th August. If you did too, please add your name to the comments.

Date: Mon, 11 Aug 2014 09:32:49 +0200
Subject: Income
From: "Zoe Mclaren" <zoemcl@kirkata.com>
To: REDACTED@cantab.net
-- Does this function already exist? Because it's not liftA2 / liftM2
foo :: (a -> a -> a) -> Maybe a -> Maybe a -> Maybe a
foo f x Nothing = x
foo f Nothing x = x
foo f (Just x) (Just y) = Just (f x y)
$ # https://github.com/doismellburning/seriousmorse/blob/1faa21ef5f5f10735f1c9f606128102a6977a09f/src/Main.hs#L33
$ make run
cabal run
Preprocessing executable 'seriousmorse' for seriousmorse-0.1.0.0...
[1 of 1] Compiling Main ( src/Main.hs, dist/build/seriousmorse/seriousmorse-tmp/Main.o )
Linking dist/build/seriousmorse/seriousmorse ...
Building channels
Starting Arduino loop
[1:61729608745] hArduino: Accessing arduino located at: "/dev/cu.usbmodemfd131"
*** hArduino:ERROR: /dev/cu.usbmodemfd131: openFd: does not exist (No such file or directory)
@doismellburning
doismellburning / gunicorn_conf.py
Created September 8, 2014 15:33
gunicorn config for Apache2-esque logging
accesslog = '-'
access_log_format = '%({Host}i)s %(h)s %(l)s "%({X-Remote-User-Id}o)s: %({X-Remote-User-Name}o)s" %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s'
$ pip install -e .
Obtaining file:///private/tmp
Running setup.py (path:/private/tmp/setup.py) egg_info for package from file:///private/tmp
error in X setup command: 'install_requires' must be a string or list of strings containing valid project/version requirement specifiers
Complete output from command python setup.py egg_info:
error in X setup command: 'install_requires' must be a string or list of strings containing valid project/version requirement specifiers
----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /private/tmp
#!/bin/bash
INFILE=$2
MESSAGE=$1
OUTFILE="$2.watermarked.jpg"
SIZE="6000x800" # Fiddle as needed
POINTSIZE="400" # Fiddle as needed
convert -size $SIZE xc:none -fill grey -pointsize $POINTSIZE -gravity Center -draw "text 0,0 '$MESSAGE'" miff:- | composite
from django.contrib.staticfiles.storage import staticfiles_storage
from django.views.generic.base import RedirectView
urlpatterns = patterns('',
rl(r'^favicon.ico$', RedirectView.as_view(url=staticfiles_storage.url('favicon.ico'), permanent=False), name="favicon"),
# ...
@doismellburning
doismellburning / myproject.conf
Last active August 29, 2015 14:10
Skeleton gunicorn + upstart config
start on runlevel [2345]
stop on runlevel [!2345]
setuid $UID
setgid $GID
exec gunicorn --bind 0.0.0.0:$PORT myproject.wsgi:application