Skip to content

Instantly share code, notes, and snippets.

View billy1380's full-sized avatar

William Shakour billy1380

View GitHub Profile
@billy1380
billy1380 / forkjoincounter
Last active June 27, 2017 16:58
fork join counter
# https://www.youtube.com/watch?v=zSDC_TU7rtc
def insert(sum_name, delta):
index = memcache.get('index-' + sum_name)
if index is None:
memcache.add('index-' + sum_name, 1)
index = memcache.get ('index-' + sum_name)
lock = '%s-lock-%d' % (sum_name, index)
writers = memcache.incr(lock, initial_value = 2 ** 16)
@billy1380
billy1380 / gist:35460f6868f96e176aa3
Created November 26, 2014 17:35
x.gwt.xml linker flags
<!-- classic mode 2.7 -->
<add-linker name="xs"/>
<!-- superdev mode 2.5 -->
<add-linker name="xsiframe"/>
<set-configuration-property name="xsiframe.failIfScriptTag" value="false"/>
<set-configuration-property name="devModeRedirectEnabled" value="true"/>
@billy1380
billy1380 / done.snippet.java
Created June 30, 2014 13:37
Read and write .done files to mark long completion process
public static void writeDoneFile(String filePath) throws IOException {
String doneFilePath = filePath + ".done";
FileOutputStream out = null;
try {
out = new FileOutputStream(doneFilePath);
out.write(SimpleDateFormat.getInstance().format(new Date()).getBytes());
} finally {
if (out != null) {