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 net.c0f3.random.tests; | |
import org.junit.Test; | |
import org.mockito.invocation.InvocationOnMock; | |
import org.mockito.stubbing.Answer; | |
import java.util.concurrent.atomic.AtomicInteger; | |
import static org.mockito.Mockito.*; |
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 | |
function parse_properties($txtProperties) { | |
$result = array(); | |
$lines = split("\n", $txtProperties); | |
$key = ""; | |
$isWaitingOtherLine = false; | |
foreach ($lines as $i => $line) { | |
if (empty($line) || (!$isWaitingOtherLine && strpos($line, "#") === 0)) | |
continue; | |
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 selly.spring.data.convert; | |
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.Collection; | |
import java.util.HashMap; | |
import java.util.List; | |
import java.util.Map; | |
import org.springframework.beans.factory.config.BeanDefinition; |
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 ru.infon.azerfon.mas.module; | |
import com.cronutils.model.CronType; | |
import com.cronutils.model.definition.CronDefinition; | |
import com.cronutils.model.definition.CronDefinitionBuilder; | |
import com.cronutils.model.time.ExecutionTime; | |
import com.cronutils.parser.CronParser; | |
import org.joda.time.DateTime; | |
import org.joda.time.format.DateTimeFormat; | |
import org.joda.time.format.DateTimeFormatter; |
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 | |
$ytdlPath = '/whereever/your/youtube-dl'; //change this | |
ob_start(); | |
$url = trim(rawurldecode($_SERVER['QUERY_STRING'])); | |
$qStr = parse_url($url, PHP_URL_QUERY ); | |
parse_str($qStr, $get); | |
if (!isset($get['v']) || !preg_match('~[a-zA-Z0-9_-]{11}~',$get['v']) ) { |
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
CacheEntity<K,V> execute(CacheEntity<K,V> cacheEntity, Action action) { | |
long now = System.currentTimeMillis(); | |
if(cacheEntity==null) { | |
return null; | |
} | |
if(cacheEntity.isExpired()) { | |
storage.remove(cacheEntity); | |
return null; | |
} |
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
public class LongNumberTruncate { | |
public static void main(String[] args) { | |
long[] values = new long[8]; | |
values[0] = 1234567891234567891L; // 16 | |
values[1] = 123456789223456789L; // 15 | |
values[2] = 123456789323456L; // 14 | |
values[3] = 1234567894236L; // 13 | |
values[4] = 1234567895L; // 10 |
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
http { | |
log_format bodylog '$remote_addr - $remote_user [$time_local] ' | |
'"$request" $status $body_bytes_sent ' | |
'"$http_referer" "$http_user_agent" $request_time ' | |
'<"$request_body" >"$resp_body"'; | |
lua_need_request_body on; | |
set $resp_body ""; | |
body_filter_by_lua_block { |
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
public class SingleLatch { | |
static final int STATE_OPEN = 0; | |
static final int STATE_CLOSED = 1; | |
public enum State { | |
OPEN(STATE_OPEN), | |
CLOSED(STATE_CLOSED); | |
int state; |
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 net.c0f3.scripting; | |
import org.apache.commons.logging.Log; | |
import java.io.IOException; | |
import java.io.StringWriter; | |
import java.io.Writer; | |
public class LogOutputWriter extends Writer { |
OlderNewer