Skip to content

Instantly share code, notes, and snippets.

curl -i --request PROPFIND --insecure --digest -u user:password --header "Content-Type: text/xml" --header "Brief:t" \
https://dav.url/card.php/addressbooks/user/default/
curl -i --request PROPFIND --insecure --digest -u user:password --header "Content-Type: text/xml" --header "Brief:t" \
https://dav.url/cal.php/principals/user/
@bamthomas
bamthomas / gist:a826ab04377c78f0de63316fc1b61ba3
Last active February 3, 2018 13:53
capture FP2 on openwrt router
tcpdump -i br-lan host android-25ac02f8e4ea5f61
13:47:46.547385 IP dune.io.imaps > android-25ac02f8e4ea5f61.lan.36478: Flags [P.], seq 1966813352:1966813398, ack 521680810, win 261, options [nop,nop,TS val 3655118434 ecr 23066180], length 46
13:47:46.670093 IP dune.io.imaps > android-25ac02f8e4ea5f61.lan.48402: Flags [P.], seq 1986507477:1986507523, ack 632287404, win 243, options [nop,nop,TS val 3655118464 ecr 23066192], length 46
13:47:46.735749 IP android-25ac02f8e4ea5f61.lan.36478 > dune.io.imaps: Flags [.], ack 46, win 1822, options [nop,nop,TS val 23075340 ecr 3655118434], length 0
13:47:46.736316 IP android-25ac02f8e4ea5f61.lan.48402 > dune.io.imaps: Flags [.], ack 46, win 1550, options [nop,nop,TS val 23075340 ecr 3655118464], length 0
13:47:51.550928 ARP, Request who-has android-25ac02f8e4ea5f61.lan tell OpenWrt.lan, length 28
13:47:51.648474 ARP, Reply android-25ac02f8e4ea5f61.lan is-at 84:cf:bf:8b:32:e4 (oui Unknown), length 28
13:47:58.244076 ARP, Request who-has OpenWrt.lan tell android-25ac02f8
# -*- coding: utf-8 -*-
import logging
from sqlalchemy import Column
from sqlalchemy import ForeignKey
from sqlalchemy import Integer
from sqlalchemy import String
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import scoped_session, relationship
@bamthomas
bamthomas / filesystem_tree.js
Last active December 7, 2016 19:52
js migration ES6
export class Node {
constructor(name, data, children = undefined) {
this.name = name;
this.data = data;
this.children = children;
}
is_dir() {
return this.children !== undefined;
};
### Keybase proof
I hereby claim:
* I am bamthomas on github.
* I am bamthomas (https://keybase.io/bamthomas) on keybase.
* I have a public key whose fingerprint is 3BD1 A1EE 2615 82ED 1CC8 60CE 1E58 68FD 1070 09A2
To claim this, I am signing this object:
@bamthomas
bamthomas / Dockerfile
Created April 1, 2016 08:45
ubuntu 14LTS with docker
FROM ubuntu:14.04
RUN apt-get -y update && apt-get -y install apt-transport-https ca-certificates
RUN apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
RUN echo 'deb https://apt.dockerproject.org/repo ubuntu-trusty main' > /etc/apt/sources.list.d/docker.list
RUN apt-get -y update && apt-get -y install docker-engine
@bamthomas
bamthomas / update_hosts.sh
Last active December 22, 2015 14:21
update /etc/hosts to link with localhost the docker-compose services
#!/bin/bash
# -*- coding: UTF8 -*-
function rm_hosts {
for container_name in $*
do
host=$(docker inspect --format '{{ index .Config.Labels "com.docker.compose.service" }}' $container_name)
remove_line_infile $host /etc/hosts
done
}
@bamthomas
bamthomas / gist:b0f1fc0e1211fb49f155
Created June 12, 2015 22:11
aiomysql exception
Traceback (most recent call last):
File "/home/bruno/src/DomoPyc/venv/lib/python3.4/site-packages/aiomysql/connection.py", line 466, in _read_packet
packet_header = yield from self._reader.readexactly(4)
File "/usr/local/lib/python3.4/asyncio/streams.py", line 482, in readexactly
raise IncompleteReadError(partial, len(partial) + n)
asyncio.streams.IncompleteReadError: 0 bytes read on a total of 4 expected bytes
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
@bamthomas
bamthomas / tcpdump_vlan100.sh
Created April 19, 2015 15:35
tcpdump vlan 100 freebox
tcpdump -i eth0 -Uw - | tcpdump -en -r - vlan 100
15:33:48.204734 00:07:cb:c6:5a:d2 > ff:ff:ff:ff:ff:ff, ethertype 802.1Q (0x8100), length 334: vlan 100, p 0, ethertype IPv4, 0.0.0.0.68 > 255.255.255.255.67: BOOTP/DHCP, Request from 00:07:cb:c6:5a:d2, length 288
15:33:48.220336 00:07:cb:c6:5a:d2 > ff:ff:ff:ff:ff:ff, ethertype 802.1Q (0x8100), length 346: vlan 100, p 0, ethertype IPv4, 0.0.0.0.68 > 255.255.255.255.67: BOOTP/DHCP, Request from 00:07:cb:c6:5a:d2, length 300
15:33:48.928038 00:07:cb:c6:5a:d2 > 33:33:00:00:00:16, ethertype 802.1Q (0x8100), length 94: vlan 100, p 0, ethertype IPv6, :: > ff02::16: HBH ICMP6, multicast listener report v2, 1 group record(s), length 28
15:33:49.088055 00:07:cb:c6:5a:d2 > 33:33:ff:c6:5a:d2, ethertype 802.1Q (0x8100), length 82: vlan 100, p 0, ethertype IPv6, :: > ff02::1:ffc6:5ad2: ICMP6, neighbor solicitation, who has fe80::207:cbff:fec6:5ad2, length 24
15:33:50.088024 00:07:cb:c6:5a:d2 > 33:33:00:00:00:02, ethertype 802.1Q (0x8100), length 74: vlan 100, p 0, ethertyp
def assert_dict_is_in_csv(exported_file_content, expected_line_dict):
lines = exported_file_content.rstrip('\r\n').split('\r\n')
for line in lines:
if all(['%s' % value in line for value in expected_line_dict.values()]):
return
raise AssertionError('%s not in file [%s]' % (expected_line_dict, lines))