Skip to content

Instantly share code, notes, and snippets.

View proger's full-sized avatar
🎯
Focusing

Volodymyr Kyrylov proger

🎯
Focusing
View GitHub Profile
io root local/etc/openldap 1 # grep '^root' slapd.conf
rootdn "cn=proger,dc=wilab,dc=org,dc=ua"
rootpw secret
io root local/etc/openldap 0 # /opt/local/bin/ldapadd -f schema/nis.ldif -x -D cn=proger,dc=wilab,dc=org,dc=ua -w secret
adding new entry "cn=nis,cn=schema,cn=config"
ldap_add: Insufficient access (50)
io root local/etc/openldap 0 # /opt/local/libexec/slapd -4d 9 -f ./slapd.conf
@(#) $OpenLDAP: slapd 2.4.21 (Apr 22 2010 23:59:52) $
[email protected]:/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_databases_openldap/work/openldap-2.4.21/servers/slapd
daemon_init: listen on ldap:///
daemon_init: 1 listeners to open...
ldap_url_parse_ext(ldap:///)
daemon: listener initialized ldap:///
daemon_init: 1 listeners opened
ldap_create
slapd init: initiated server.
We couldn’t find that file to show.
hw.machine=i386
hw.model=Intel(R) Core(TM)2 CPU T5600 @ 1.83GHz ("GenuineIntel" 686-class)
hw.ncpu=2
hw.byteorder=1234
hw.pagesize=4096
hw.disknames=sd0,sd1
hw.diskcount=2
hw.sensors.acpitz0.temp0=70.00 degC (zone temperature)
hw.sensors.acpitz1.temp0=78.00 degC (zone temperature)
hw.sensors.acpibat0.volt0=14.40 VDC (voltage)
error: call of overloaded 'TraverseStmtChildren(Function*&, clang::Stmt*&)' is ambiguous
note: candidates are: void TraverseStmtChildren(Function*, clang::Stmt*)
note: void current_namespace::TraverseStmtChildren(Function*, clang::Stmt*)
@proger
proger / syscallsample.c
Created November 20, 2010 19:13
syscall execution time sampling test
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#define NSAMPLES 64
struct sample {
u_int64_t pre;
u_int64_t post;
u_int64_t cycles;
In [32]: k = [Q(**{'%s__icontains' % f: '&nbsp;'}) for f in [f.name for f in MyModel._meta.fields if f.__class__ is db.models.TextField]]
In [33]: reduce(lambda all, q: all|q, k, Q())
Out[33]: <db.models.query_utils.Q object at 0x162fe0630>
In [34]: MyModel.objects.filter(_)
[.....]
@proger
proger / gist:801168
Created January 28, 2011 22:44
question
-- generate an infinite sequence of sign alternating numbers
-- how to make it really infinite so foldl doesn't take away the laziness of the evaluation?
alternating count = foldl (\x (a,b) -> x ++ [a,b]) [] $ take count [(x,y) | x <- [1..], let y = negate x]
-- out:
[1,-1,2,-2,3,-3,4,-4,5,-5,6,-6,7,-7,8,-8,9,-9,10,-10]
-- variants:
import inspect
class Y(object):
def ymethod(self, x):
x.method()
class X(object):
def method(self):
frame = inspect.currentframe()
prev = frame.f_back
import sys
import random
import struct
import time
packet = lambda *args: struct.pack('!HQBBBB', 0xbaba, *args)
seq = 1
while True:
p = packet(seq, *[random.randint(1, 255) for i in xrange(4)])