Skip to content

Instantly share code, notes, and snippets.

#include <openssl/bio.h>
#include <openssl/evp.h>
void base64calc(const unsigned char* msg, size_t msgsize, char* out, size_t outsize) {
BIO *bio, *b64, *mem;
// Shit, this base64 thing with openssl was hard to get right.
b64 = BIO_new(BIO_f_base64());
package test2;
import java.util.Random;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.espertech.esper.client.Configuration;
import com.espertech.esper.client.EPAdministrator;
import com.espertech.esper.client.EPRuntime;
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Alejandro Santos, @alejolp.
"""
This program deadlocks beacuse producers are also consumers and the Queue
has a fixed limit. When the consumer reaches a specific level on the expansion
tree, deadlocks.
"""
$ uname -a
Linux computer 2.6.32-431.5.1.el6.i686 #1 SMP Wed Feb 12 09:07:48 CET 2014 i686 i686 i386 GNU/Linux
$ python
Python 2.6.6 (r266:84292, Jan 23 2014, 10:37:44)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
$ python pyseektest.py
/* $ g++ -Wall -std=c++0x pyt.cpp */
#include <iostream>
struct triple {
int x, y, z;
};
class pyt {
public:
import java.util.Date;
import com.espertech.esper.client.Configuration;
import com.espertech.esper.client.EPAdministrator;
import com.espertech.esper.client.EPRuntime;
import com.espertech.esper.client.EPServiceProvider;
import com.espertech.esper.client.EPServiceProviderManager;
import com.espertech.esper.client.EventBean;
import com.espertech.esper.client.UpdateListener;
import com.espertech.esper.client.time.CurrentTimeEvent;
#!/usr/bin/env python
"""
http://en.wikipedia.org/wiki/Bin_packing_problem
"""
import os, sys, random
def empaquetar_ordenado(E, L, Ordenar=True):
if Ordenar:
#!/usr/bin/env python3
# coding: utf-8
import os
import pprint
import sys
def tokenize_file(file_name):
output = []
with open(file_name, 'r', encoding="utf-8") as f:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Implementacion para entender cómo es el algoritmo de los Multiplicative
Scramblers.
Referencias:
- http://en.wikipedia.org/wiki/Scrambler#Multiplicative_.28self-synchronizing.29_scramblers
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Alejandro Santos, alejolp@alejolp.com.ar
Adaptador de un Iterador para saber si el Iterador original tiene
un proximo elemento. Igual que los iteradores de Java:
http://download.oracle.com/javase/1.5.0/docs/api/java/util/Iterator.html