Skip to content

Instantly share code, notes, and snippets.

View ewxrjk's full-sized avatar

Richard Kettlewell ewxrjk

View GitHub Profile
@ewxrjk
ewxrjk / gist:cbaf528e526cf9d6017d
Last active August 29, 2015 14:19
Bizarre /dev/tty behavior on GNU HUrd
araminta:~$ ssh heceptor -t ls -l /dev/tty
crw--w---- 1 richard tty 0, 0 Jul 14 2012 /dev/tty
Connection to heceptor closed.
araminta:~$ ssh heceptor 'echo /dev/tt?'
/dev/tty
araminta:~$ ssh heceptor ls -l /dev/tty
ls: cannot access /dev/tty: No such device or address
araminta:~$ ssh heceptor uname -a
GNU heceptor 0.3 GNU-Mach 1.3.99-486/Hurd-0.3 i686-AT386 GNU
@ewxrjk
ewxrjk / gist:c3f80a16d61c35678301
Last active August 29, 2015 14:20
clang -fsanitize=address breaks initial stream orientation
richard@deodand:~/junk$ cat t.c
#include <stdio.h>
#include <wchar.h>
int main(void) {
FILE *fp = fopen("/dev/null", "r");
return printf("initial orientation: %d\n", fwide(fp, 0));
}
richard@deodand:~/junk$ clang-3.6 -fsanitize=address -o t t.c
richard@deodand:~/junk$ ./t
@ewxrjk
ewxrjk / gist:6c532651533403dd31c3
Last active August 29, 2015 14:20
Debian sid unprivileged container setup
Install required packages:
# apt-get install uidmap lxc
# ..and cgmanager? or not? Who can say?
Enable unshare:
# echo 'kernel.unprivileged_userns_clone = 1' >> /etc/sysctl.d/local.conf
# sysctl --system
Check /etc/subuid and /etc/subgid and add ranges if missing, e.g.:
# usermod -v 886432-951967 richard
@ewxrjk
ewxrjk / debmirror output
Created May 10, 2015 11:01
debmirror can't find diffs
Mirroring to /space/mirrors/debian from http://ftp.uk.debian.org/debian/
Arches: amd64,i386
Dists: jessie,jessie-updates,jessie-backports,stretch,stretch-updates,sid
Sections: main,contrib,non-free,main/debian-installer
Including source.
Pdiff mode: use
Will clean up after mirroring.
Attempting to get lock ...
Updating remote trace files (using rsync) ...
@ewxrjk
ewxrjk / gist:07163a67894b0e65a4f6
Created May 26, 2015 18:24
Mysterious error output
From: root@...
To: root@...
Subject: Cron <root@...> test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
Date: Tue, 26 May 2015 02:28:06 +0100
/etc/cron.daily/logrotate:
2015/05/26 02:26:51| WARNING: (B) '127.0.0.1' is a subnetwork of (A) '127.0.0.1'
2015/05/26 02:26:51| WARNING: because of this '127.0.0.1' is ignored to keep splay tree searching predictable
2015/05/26 02:26:51| WARNING: You should probably remove '127.0.0.1' from the ACL named 'localhost'
2015/05/26 02:26:51| WARNING: (B) '127.0.0.1' is a subnetwork of (A) '127.0.0.1'
@ewxrjk
ewxrjk / syncretism!
Created June 28, 2015 13:22
Syncretism!
$ dig mx va
; <<>> DiG 9.9.5-9-Debian <<>> mx va
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 18186
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 6, ADDITIONAL: 16
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
@ewxrjk
ewxrjk / gist:64fde4ff96ec8ce593a8
Created September 13, 2015 10:59
Thanks, GCC
udplog.c: In function ‘main’:
udplog.c:72:5: error: assuming signed overflow does not occur when assuming that (X + c) >= X is always true [-Werror=strict-overflow]
int main(int argc, char **argv) {
^
udplog.c:72:5: error: assuming signed overflow does not occur when assuming that (X + c) >= X is always true [-Werror=strict-overflow]
cc1: all warnings being treated as errors
@ewxrjk
ewxrjk / gist:4a6b373691962ec2eb3d
Last active November 22, 2015 18:52
G++ LTO bug?
$ type g++-5
g++-5 is /usr/bin/g++-5
$ g++-5 --version
g++-5 (Debian 5.2.1-23) 5.2.1 20151028
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ dpkg -l g++-5 libstdc++-5-dev
Desired=Unknown/Install/Remove/Purge/Hold
$ cat 4096.py
import pyprimes
p=0xFFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6BF12FFA06D98A0864D87602733EC86A64521F2B18177B200CBBE117577A615D6C770988C0BAD946E208E24FA074E5AB3143DB5BFCE0FD108E4B82D120A92108011A723C12A787E6D788719A10BDBA5B2699C327186AF4E23C1A946834B6150BDA2583E9CA2AD44CE8DBBBC2DB04DE8EF92E8EFC141FBECAA6287C59474E6BC05D99B2964FA090C3A2233BA186515BE7ED1F612970CEE2D7AFB81BDD762170481CD0069127D5B05AA993B4EA988D8FDDC186FFB7DC90A6C0
@ewxrjk
ewxrjk / gist:ba9a3c970273132bc46300478480537a
Last active August 21, 2016 09:35
lxc guest can reach router but not host
tcpdump on host showing that container (.19) can each other hosts (e.g. .1) but does not get a response to host address (.18)
rjk@araminta:~$ really tcpdump -npi vethE23AI6: host 172.17.207.19
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on vethE23AI6:, link-type EN10MB (Ethernet), capture size 262144 bytes
10:29:25.994201 IP 172.17.207.19.48716 > 172.17.207.1.53: 64233+ A? mirror.anjou.terraraq.org.uk. (46)
10:29:25.994243 IP 172.17.207.19.48716 > 172.17.207.1.53: 58575+ AAAA? mirror.anjou.terraraq.org.uk. (46)
10:29:25.994947 IP 172.17.207.1.53 > 172.17.207.19.48716: 64233* 1/3/2 A 172.17.207.18 (169)
10:29:25.995129 IP 172.17.207.1.53 > 172.17.207.19.48716: 58575* 0/1/0 (98)
10:29:25.995240 IP 172.17.207.19.58774 > 172.17.207.18.80: Flags [S], seq 4164822563, win 29200, options [mss 1460,sackOK,TS val 13201837 ecr 0,nop,wscale 7], length 0