This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.inject.Named; | |
import javax.inject.Singleton; | |
import org.restlet.Context; | |
import org.restlet.data.Request; | |
import org.restlet.data.Response; | |
import org.restlet.resource.ResourceException; | |
import org.restlet.resource.Variant; | |
import org.sonatype.plexus.rest.resource.AbstractPlexusResource; | |
import org.sonatype.plexus.rest.resource.PathProtectionDescriptor; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pyPdf import PdfFileWriter as pw, PdfFileReader as pr | |
# crop in_file | |
in_file = 'file.pdf' | |
out_file = 'file.crop.pdf' | |
out_pdf = pw() | |
in_pdf = pr(file(in_file, 'rb')) | |
for p in range(in_pdf.getNumPages()): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.lang.reflect.Field; | |
import sun.misc.Unsafe; | |
public class T { | |
public static Unsafe u; | |
private static long fieldOffset; | |
private static T instance = new T(); | |
private Object obj; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Created with IntelliJ IDEA. | |
* User: Andrew Kondratovich | |
* Date: 2/13/12 | |
* Time: 3:53 AM | |
*/ | |
import java.nio.ByteBuffer | |
import java.util.ArrayList |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# A fatal error has been detected by the Java Runtime Environment: | |
# | |
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x6b30107f, pid=5888, tid=5620 | |
# | |
# JRE version: 7.0-b147 | |
# Java VM: Java HotSpot(TM) Client VM (21.0-b17 mixed mode, sharing windows-x86 ) | |
# Problematic frame: | |
# V [jvm.dll+0x6107f] | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[PerfHash Benchmark] | |
Running PerfHashBenchmark | |
95% gets, 2% inserts, 2% removes, table_size=1000 ALL | |
Threads from 10 to 100 by 10 | |
Warmup -variance: | |
=== CHM_16 2 cnts/sec= 20263610 | |
=== CHM_256 2 cnts/sec= 15084940 | |
=== CHM_4096 2 cnts/sec= 20211076 | |
=== NBHashMap 2 cnts/sec= 14599631 | |
=== LHM 2 cnts/sec= 1807576 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function info(show) { | |
var d = 'none'; | |
if (show) d = ''; | |
var xc4 = document.getElementsByClassName('Xc4'); | |
for (var i = 0; i < xc4.length; i++) | |
xc4[i].parentElement.style['display'] = d; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
def write_to(path, content): | |
f = open(path, 'w') | |
f.write(content.encode('utf-8')) | |
f.close() | |
def make_page(names, pwd): | |
page = '<body><ul>' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(qlct). | |
-compile([export_all]). | |
fill(T0, T1, []) -> {T0, T1}; | |
fill(T0, T1, [H | T]) -> | |
ets:insert(T0, {H, make_ref()}), | |
ets:insert(T1, {H, make_ref()}), | |
fill(T0, T1, T). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://github.com/kondratovich/machariel/blob/master/src/main/java/org/machariel/core/serialization/Serializer.java#L34 | |
private Key serializecm(Object object, int depth, ClassMap cm) { | |
final int size = Reflection.size(object); | |
final Key ref = allocator.allocate(cm, size - Reflection.MAGIC_SIZE + PTR_OFFSET); // Unsafe.allocateMemory(size) | |
allocator.put(ref, 0, size); // Unsafe.putInt(pointer, offset, value) | |
allocator.put(ref, Reflection.ARRAY_INT_INDEX_SCALE, object.getClass().hashCode()); // Unsafe.putInt(pointer, offset, value) | |
allocator.copy(object, Reflection.MAGIC_SIZE, ref, PTR_OFFSET, size - Reflection.MAGIC_SIZE); // Unsafe.copyMemory(...) | |
for (int j = 0; j < cm.refs().length; j++) { // in case we have Reference fields |
OlderNewer