Skip to content

Instantly share code, notes, and snippets.

Avatar
✌️

Noel Yahan noelyahan

✌️
View GitHub Profile
View rename-all.py
# 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
View file_path.py
# 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"}
View wso2_custom_cahe_v1.0.java
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);
@noelyahan
noelyahan / wso2_default_cahe_v0.5.java
Last active Aug 29, 2015
Simple cache creation in v0.5 jcache
View wso2_default_cahe_v0.5.java
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();
View wso2_custom_cahe_v0.5.java
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);
View wso2_default_cahe_v1.0.java
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();
You can’t perform that action at this time.