Skip to content

Instantly share code, notes, and snippets.

View RavuAlHemio's full-sized avatar

Ondřej Hošek RavuAlHemio

View GitHub Profile
diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c
index d50b783..5ded798 100644
--- a/ext/ldap/ldap.c
+++ b/ext/ldap/ldap.c
@@ -155,6 +155,15 @@ PHP_MINIT_FUNCTION(ldap)
REGISTER_LONG_CONSTANT("LDAP_DEREF_FINDING", LDAP_DEREF_FINDING, CONST_PERSISTENT | CONST_CS);
REGISTER_LONG_CONSTANT("LDAP_DEREF_ALWAYS", LDAP_DEREF_ALWAYS, CONST_PERSISTENT | CONST_CS);
+ /* Constants to be used with ldap_modify_batch() */
+ REGISTER_LONG_CONSTANT("LDAP_MODIFY_BATCH_ADD", LDAP_MODIFY_BATCH_ADD, CONST_PERSISTENT | CONST_CS);
@RavuAlHemio
RavuAlHemio / pipes-are-evil.c
Created November 10, 2012 16:56
fork-and-pipe debugging utility
/**
* @file pipes-are-evil.c
* @author Ondřej Hošek <[email protected]>
*/
#include <ctype.h>
#include <errno.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
@RavuAlHemio
RavuAlHemio / build.ninja
Created October 14, 2012 17:02
flex/bison example buildable with MSVC
cl = C:\Development\VS\VC\bin\cl.exe
flex = C:\Development\MinGW\msys\1.0\bin\flex.exe
bison = C:\Development\MinGW\msys\1.0\bin\bison.exe
cflags = /nologo /DYY_NO_UNISTD_H
lflags = /nologo
rule cc
description = CC $out
command = $cl $cflags /c /Fo$out $in
/**
* @file mysed.c
*
* @brief An oversimplified implementation of sed.
*
* @author Ondřej Hošek <[email protected]>
*/
#include <assert.h>
#include <errno.h>
@RavuAlHemio
RavuAlHemio / parser.y
Created April 1, 2012 14:35
scanner/parser, Lex/Yacc edition
/* vim: set ft=yacc: */
%start ProgramOrEmpty
%token TOK_SYM_SEMI
%token TOK_SYM_PARBEG
%token TOK_SYM_PAREND
%token TOK_SYM_COMMA
%token TOK_SYM_EQUALS
%token TOK_SYM_TILDE
@RavuAlHemio
RavuAlHemio / parser.y
Created April 1, 2012 14:32
scanner/parser, Ox edition
/* vim: set ft=yacc: */
/*
@i isn't very implicit if I have to plaster
all of my code with it...
*/
%start ProgramOrEmpty
%token TOK_SYM_SEMI
@RavuAlHemio
RavuAlHemio / SkylineSolver.lhs
Created January 20, 2012 23:14
Skyline Solver
This is a Literate Haskell file to make it that much easier to store my thoughts
concisely. I didn't know it would have such an effect on me, but at this stage,
I can only thank the language designers for it.
Skyline fields look a bit like this:
\begin{verbatim}
-1 5 4 3 2 1 -1
5 10 20 30 40 50 1
4 20 30 40 50 10 2
@RavuAlHemio
RavuAlHemio / dsort.c
Created December 11, 2011 13:16
DSort
/**
* @file dsort.c
*
* @author Ondřej Hošek (0925631)
*
* @brief DSort
* @details Concatenates the output of two programs, sorts it, and outputs
* duplicate lines.
*
* @date 2011-04-12
@RavuAlHemio
RavuAlHemio / GrowingArray.java
Created September 26, 2011 02:53
Dynamically growing array in Java
public class GrowingArray
{
Object[] array;
int count;
int capacity;
public void appending(Object obj)
{
// grow array if needed
if (count == capacity)
@RavuAlHemio
RavuAlHemio / ButtPlet.java
Created June 24, 2011 21:28
"Soften image" Java applet
/*
* ButtPlet.java
*
* Created on Jun 24, 2011, 10:46:14 PM
*/
package foon;
import java.applet.Applet;
import java.awt.event.MouseEvent;
import java.awt.image.BufferedImage;