Skip to content

Instantly share code, notes, and snippets.

View noelyahan's full-sized avatar
🍂
listening to the listener

Noel Yahan noelyahan

🍂
listening to the listener
View GitHub Profile
#include <stdio.h>
#include <iostream>
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/flann/miniflann.hpp"
#include <tesseract/baseapi.h>
using namespace cv;
using namespace std;
# run instructions : python rename_all.py folder_path start_file_prefix
# ex: python rename_all.py /home/xxx/Pictures/my_collection "Garden-"
# output will be "Garden-1.png, Garden-2.png" etc..
import sys
import os
# input arguments folder_path & rename prefix
args = sys.argv
# folder path which files are contains
# run instructions : python find.py / -m "2015-12-07 21:25:29" 30
import sys
import os
from datetime import datetime, timedelta
TIMESTAMP_FORMAT = "%Y-%m-%d %H:%M:%S";
# file mod info infomation hashmap
rwx_hash = {1:"--x", 2:"-w-", 4:"r--", 3:"-wx", 5:"r-x", 6:"rw-", 7:"rwx"}
CacheManager cacheManager = Caching.getCachingProvider().getCacheManager();
//CacheManager cacheManager = Caching.getCachingProvider().getCacheManager(new URI("sampleCacheManager"));
String cacheName = "cacheXXX";
cache = cacheManager.createCache(cacheName, new MutableConfiguration<K, V>()
.setExpiryPolicyFactory(CreatedExpiryPolicy.factoryOf(new Duration(TimeUnit.SECONDS, cacheTimeout)))
.setExpiryPolicyFactory(ModifiedExpiryPolicy.factoryOf(new Duration(TimeUnit.SECONDS, cacheTimeout)))
.setStoreByValue(false));
int value = 9876;
cache.put(key, value);
assertEquals(cache.get(key).intValue(), value);
CacheManager cacheManager = Caching.getCachingProvider().getCacheManager();
//CacheManager cacheManager = Caching.getCachingProvider().getCacheManager(new URI("sampleCacheManager"));
Cache<String, Integer> cache = cacheManager.getCache("sampleCache");
String key = "1";
int value1 = 9876;
cache.put(key, value1);
int value = cache.get(key).intValue();
CacheManager cacheManager = Caching.getCacheManagerFactory().getCacheManager("test");
String cacheName = "cacheXXX";
cache = cacheManager.<String,Integer>createCacheBuilder(cacheName).setExpiry(CacheConfiguration.ExpiryType.MODIFIED, new CacheConfiguration.Duration(TimeUnit.SECONDS, 10)).
setStoreByValue(false).build();
int value = 9876;
cache.put(key, value);
assertEquals(cache.get(key).intValue(), value);
@noelyahan
noelyahan / wso2_default_cahe_v0.5.java
Last active August 29, 2015 14:27
Simple cache creation in v0.5 jcache
CacheManager cacheManager = Caching.getCacheManagerFactory().getCacheManager("sampleCacheManager");
Cache<String, Integer> cache = cacheManager.getCache("sampleCache");
String key = "1";
int value1 = 9876;
cache.put(key, value1);
int value = cache.get(key).intValue();