Skip to content

Instantly share code, notes, and snippets.

View mtyaka's full-sized avatar

Matjaz Gregoric mtyaka

View GitHub Profile
From 44386ff6756413d4f0f1f2feab8de18293a70764 Mon Sep 17 00:00:00 2001
From: Matjaz Gregoric <[email protected]>
Date: Tue, 12 Jan 2010 03:03:16 +0100
Subject: [PATCH 1/2] Add option to configure flash keys.
---
app/controllers/confirmations_controller.rb | 4 ++--
app/controllers/passwords_controller.rb | 4 ++--
app/controllers/sessions_controller.rb | 8 ++++----
generators/devise_install/templates/devise.rb | 5 +++++
ERROR in (test-deploy-custom-url) (AbstractArtifactTask.java:482)
Uncaught exception, not in assertion.
expected: nil
actual: java.lang.NullPointerException: null
at org.apache.maven.artifact.ant.AbstractArtifactTask.getContainer (AbstractArtifactTask.java:482)
org.apache.maven.artifact.ant.AbstractArtifactTask.getProfileManager (AbstractArtifactTask.java:709)
org.apache.maven.artifact.ant.Pom.getActivatedProfiles (Pom.java:470)
org.apache.maven.artifact.ant.Pom.createProjectBuilderConfig (Pom.java:501)
org.apache.maven.artifact.ant.Pom.initialiseMavenProject (Pom.java:208)
org.apache.maven.artifact.ant.AbstractArtifactTask.initializePom (AbstractArtifactTask.java:527)
@mtyaka
mtyaka / elasticsearch.yml
Created March 9, 2012 15:21
Case insensitive tags in ES
# Add this to config/elasticsearch.yml file to register the custom analyzer:
# Register the custom 'lowercase_keyword' analyzer. It doesn't do anything else
# other than changing everything to lower case.
index.analysis.analyzer.lowercase_keyword.type: custom
index.analysis.analyzer.lowercase_keyword.tokenizer: keyword
index.analysis.analyzer.lowercase_keyword.filter: [lowercase]
@mtyaka
mtyaka / es.rb
Created March 9, 2012 16:47
Batch insert images into ES index
website = Website.first
es = ElasticSearch.new('localhost:9200', :index => "tags", :type => "image")
count = 0
images = website.images.includes(:meta_tags).where("copied_image_id is ? and deleted = ?", nil, 0);
images.each_slice(1000) do |images|
puts count if count % 10 == 0
es.bulk do |client|
images.each do |image|
tags = image.meta_tags.map {|t| t.category_and_name }
uploader.destroy();
uploader = new plupload.Uploader({
runtimes : 'silverlight',
browse_button : 'pickfiles',
container : 'container',
max_file_size : '20mb',
url : '/upload/to_gallery?gallery=3656601', // <-- change gallery_id here
flash_swf_url : '/plupload/plupload.flash.swf',
silverlight_xap_url : '/plupload/plupload.silverlight.xap',
This file has been truncated, but you can view the full file.
[root@server ~]# strace -fp 5497
Process 5497 attached with 2 threads - interrupt to quit
[pid 5498] futex(0x7fa1b80008c8, FUTEX_WAIT_PRIVATE, 0, NULL <unfinished ...>
[pid 5497] epoll_wait(5, {{EPOLLIN, {u32=10, u64=10}}}, 1024, 4294967295) = 1
[pid 5497] accept4(10, 0, NULL, SOCK_CLOEXEC|SOCK_NONBLOCK) = 11
[pid 5497] futex(0x7fa1b80008c8, FUTEX_WAKE_PRIVATE, 1) = 1
[pid 5498] <... futex resumed> ) = 0
[pid 5498] nanosleep({0, 900000}, NULL) = 0
[pid 5498] futex(0x7fa1b80008c8, FUTEX_WAIT_PRIVATE, 0, NULL <unfinished ...>
[pid 5497] futex(0x7fa1b80008c8, FUTEX_WAKE_PRIVATE, 1 <unfinished ...>
This file has been truncated, but you can view the full file.
[root@server ~]# strace -fp 28531
Process 28531 attached with 2 threads - interrupt to quit
[pid 28532] futex(0x7fa1880008c8, FUTEX_WAIT_PRIVATE, 0, NULL <unfinished ...>
[pid 28531] epoll_wait(5, {{EPOLLIN, {u32=10, u64=10}}}, 1024, 4294967295) = 1
[pid 28531] accept4(10, 0, NULL, SOCK_CLOEXEC|SOCK_NONBLOCK) = 11
[pid 28531] futex(0x7fa1880008c8, FUTEX_WAKE_PRIVATE, 1) = 1
[pid 28532] <... futex resumed> ) = 0
[pid 28532] futex(0x7fa1880008c8, FUTEX_WAIT_PRIVATE, 0, NULL <unfinished ...>
[pid 28531] futex(0x7fa1880008c8, FUTEX_WAKE_PRIVATE, 1 <unfinished ...>
[pid 28532] <... futex resumed> ) = -1 EAGAIN (Resource temporarily unavailable)
@mtyaka
mtyaka / pdftocairo-stdout.patch
Last active December 20, 2015 21:19
Patches poppler's pdftocairo to be able to write result to stdout. Tested with pdftocairo 0.22.5.
diff --git a/utils/pdftocairo.cc b/utils/pdftocairo.cc
index 192d295..2c4e05a 100644
--- a/utils/pdftocairo.cc
+++ b/utils/pdftocairo.cc
@@ -664,6 +664,9 @@ static GooString *getImageFileName(GooString *outputFileName, int numDigits, int
{
char buf[10];
GooString *imageName = new GooString(outputFileName);
+ if (imageName->cmp("fd://0") == 0) { // stdout
+ return imageName;
@mtyaka
mtyaka / pdftocairo-jpegquality.patch
Last active February 3, 2017 20:59
Patches poppler's pdftocairo to be able to set jpeg quality parameter. Tested with pdftocairo 0.22.5.
diff --git a/utils/pdftocairo.cc b/utils/pdftocairo.cc
index bf7072c..743016d 100644
--- a/utils/pdftocairo.cc
+++ b/utils/pdftocairo.cc
@@ -99,6 +99,7 @@ static GBool mono = gFalse;
static GBool gray = gFalse;
static GBool transp = gFalse;
static GooString icc;
+static int jpegQuality = -1;
@mtyaka
mtyaka / pdftocairo-pngcompression.patch
Created August 19, 2013 10:31
Patches poppler's pdftocairo to be able to set zlib compression level when generating png files. Tested with pdftocairo 0.22.5.
diff --git a/goo/PNGWriter.cc b/goo/PNGWriter.cc
index b775600..d484991 100644
--- a/goo/PNGWriter.cc
+++ b/goo/PNGWriter.cc
@@ -35,8 +35,20 @@ struct PNGWriterPrivate {
int icc_data_size;
char *icc_name;
bool sRGB_profile;
+ int zlib_compression_level;
};