Skip to content

Instantly share code, notes, and snippets.

@jan-matejka
jan-matejka / gist:5093141
Created March 5, 2013 19:04
pdf total page number counter
total=0; for i in *pdf; do total=$(($total + `pdfinfo $i | grep Pages: | ydu spacesquash -s | cut -d " " -f 2`)); done; echo $total
commit a210bee6273041cf9773383e2dda58a7d7c84be4
Author: yac <[email protected]>
Date: Fri Mar 8 17:56:58 2013 +0100
+ SET LC_
diff --git a/src/test/regress/expected/int8.out b/src/test/regress/expected/int8.out
index 811d6a5..e67be7d 100644
--- a/src/test/regress/expected/int8.out
+++ b/src/test/regress/expected/int8.out
:~ # rpm --help | grep -- --whatrequires
--whatrequires query/verify the package(s) which require a
--whatrequires query/verify the package(s) which require a
:~ # rpm --whatrequires libpq5
RPM version 4.4.2.3
Copyright (C) 1998-2002 - Red Hat, Inc.
This program may be freely redistributed under the terms of the GNU GPL
Usage: rpm [-aKfgpWHqV] [-aKfgpWHqVcdilPs] [-aKfgpWHqVcdilPsaKfgpWHqV] [-aKfgpWHqVcdilPsaKfgpWHqV] [-aKfgpWHqVcdilPsaKfgpWHqV] [-aKfgpWHqVcdilPsaKfgpWHqVK] [-aKfgpWHqVcdilPsaKfgpWHqVK] [-aKfgpWHqVcdilPsaKfgpWHqVKi] [-aKfgpWHqVcdilPsaKfgpWHqVKiv] [-aKfgpWHqVcdilPsaKfgpWHqVKiv] [-aKfgpWHqVcdilPsaKfgpWHqVKiv?] [-a|--all] [-f|--file] [-g|--group]
[-p|--package] [-W|--ftswalk] [--pkgid] [--hdrid] [--fileid]
@jan-matejka
jan-matejka / gist:5294211
Created April 2, 2013 17:24
pcap_read_linux_mmap call tree
pcap_read_linux_mmap
- activate_mmap(pcap_t *handle, int *status)
# ifdef HAVE_PACKET_RING -> ifdef PF_PACKET && TPACKET_HDRLEN -> (Linux/include/uapi/linux/if_packet.h:116)
# handle->read_op = pcap_read_linux_mmap;
- pcap_activate_linux(const char *device, char *ebuf)
- pcap_create_interface
# handle->activate_op = pcap_activate_linux;
- pcap_create(const char *source, char *errbuf
- pcap_open_live(const char *source, int snaplen, int promisc, int to_ms, char *errbuf)
- add_or_find_if(pcap_if_t **curdev_ret, pcap_if_t **alldevs, const char *name, u_int flags, const char *description, char *errbuf)
@jan-matejka
jan-matejka / flatMap.py
Last active December 16, 2015 03:39
what am I missing?
#! /usr/bin/env python
from itertools import chain
from functools import partial
from nose.tools import ok_, eq_
def flatMap1(m, f):
m = [f(i) for i in m if f(i)]
return reduce(lambda acc,n: acc + n, m, [])
@jan-matejka
jan-matejka / gist:5470868
Created April 26, 2013 22:27
getenv wat
yac@rainbowdash % cat main.c
#include <stdio.h>
#include <stdlib.h>
int main(void) {
printf("PORTDIR=%s\n", getenv("PORTDIR"));
return 0;
}
--------------------------------------------------------------------------------
~/wat
"rdiff-backup"
package_policy => "add",
package_select => "==",
package_version => "1.2.8-r1",
package_method => generic;
@jan-matejka
jan-matejka / Training-RFC
Created June 27, 2013 17:34
I may be overengineering this.
Training RFC
############
import rfc2119
The training
============
The training process
---------------------
--- /var/lib/cportage/portage/eclass/twisted.eclass 2011-12-27 07:54:23.000000000 +0100
+++ twisted-r1.eclass 2013-07-10 21:50:31.925408788 +0200
@@ -2,7 +2,7 @@
# Distributed under the terms of the GNU General Public License, v2 or later
# $Header: /var/cvsroot/gentoo-x86/eclass/twisted.eclass,v 1.10 2011/12/27 06:54:23 floppym Exp $
-# @ECLASS: twisted.eclass
+# @ECLASS: twisted-r1.eclass
# @MAINTAINER:
# Gentoo Python Project <[email protected]>
@jan-matejka
jan-matejka / gist:5977345
Created July 11, 2013 17:15
this is wrong
#! /bin/sh
set -eu
test_1() {
main() {
echo "1A"
false
echo "1B"
}