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
package throttle | |
import java.util.concurrent.ConcurrentHashMap | |
import java.util.concurrent.ConcurrentMap | |
import java.util.concurrent.FutureTask | |
import javax.inject.Named | |
import org.aspectj.lang.ProceedingJoinPoint | |
import org.aspectj.lang.Signature |
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
package throttle | |
@Named | |
class TestThrottle { | |
@Throttle(count = 5, periodMillis = 300000L) | |
public String authenticate(String user, String pass) { | |
// this block will be invoked no more than 5 times in 5 minutes | |
// if you reach the limit, thread will block until the period is expired | |
} |
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
package throttle | |
import java.util.concurrent.Executors | |
import java.util.concurrent.ScheduledExecutorService | |
import java.util.concurrent.ScheduledFuture | |
import java.util.concurrent.Semaphore | |
import java.util.concurrent.TimeUnit | |
import javax.annotation.PreDestroy |
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
-- per gli .import: | |
-- tail -n +2 # rimuove l'header | |
-- sed 's/.$//' # rimuove l'ultimo separator | |
CREATE TABLE inducks_storyversion ( | |
storyversioncode varchar(19) PRIMARY KEY, | |
storycode varchar(19), | |
entirepages int(7), | |
brokenpagenumerator int(7), | |
brokenpagedenominator int(7), | |
brokenpageunspecified CHAR(1) CHECK(brokenpageunspecified IN ('Y','N')), |
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
-- based on http://coa.inducks.org/inducks/isv/createtables.sql | |
-- TODO: FTI not implemented | |
CREATE TABLE inducks_storyversion ( | |
storyversioncode varchar(19), | |
storycode varchar(19), | |
entirepages int(7), | |
brokenpagenumerator int(7), | |
brokenpagedenominator int(7), | |
brokenpageunspecified CHAR(1) CHECK(brokenpageunspecified IN ('Y','N')), | |
kind varchar(1), |
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
#!/bin/bash | |
# imports inducks data files into sqlite db | |
# tested with: | |
# - UNRAR 5.00 beta 8 | |
# - sqlite 3.8.2 2013-12-06 14:53:30 27392118af4c38c5203a04b8013e1afdb1cebd0d | |
# before running: | |
# wget http://coa.inducks.org/inducks/isv.rar | |
# wget https://gist.githubusercontent.com/davide-romanini/e92f7ce5c582f54a34ea/raw/ba042b6b0debed472519150cdf05093627c11d6a/inducks_sqlite.sql | |
# cat inducks_sqlite.sql|sqlite3 coa.sqlite | |
ISV_RAR="isv.rar" |
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 struct import pack, unpack | |
from collections import namedtuple | |
import zlib | |
EOCD = 'PK\x05\x06' | |
CD = 'PK\x01\x02' | |
EOCDRecord = namedtuple( 'EOCDRecord', [ | |
'signature', | |
'diskNumber', | |
'diskWithCentralDirStart', |
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
""" | |
Read ZIP files over sliceable objects. This is a modified version | |
of the original python zipfile implementation. | |
The main use case is to provide an efficient way to read | |
even large zip files over remote sites allowing for RANGE | |
queries. | |
This work has been ispired by the pinch project | |
https://github.com/peterhellberg/pinch |
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
<?php | |
class Psr7PipeWrapper implements \Psr\Http\Message\StreamInterface | |
{ | |
/** | |
* | |
* @var resource | |
*/ | |
private $process; |
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
#@gmic comic_enhance : unsharp_level=0 bg=255,255,255 black=0,0,0 white=255,255,255 noise_rm=3,3,1 bilateral=10,10,2 erode=0 desaturate=0 | |
#@gmic : Applies a bunch of filters to better render scanned comics | |
#@gmic : - unsharp (default 0): enhance details, useful for blurry scans | |
#@gmic : - bg: background color to remove. This color is blended in divisor mode, useful for vintage comics | |
#@gmic : - black: black point used to adjust color curves | |
#@gmic : - white: white point used to adjust color curves | |
#@gmic : - noise_rm (3,3,1): uses -iain_iains_nr filter to smooth out colors. slow but effective. | |
#@gmic : - bilateral (10,10,2): uses -gimp_bilateral as a second smoothing step | |
#@gmic : - erode: uses -gimp_morpho with circular kernel and minimal size of 2 to "engrave" strokes | |
#@gmic : - desaturate: uses the -desaturate_luminosity filter for grayscale pages |