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
/* A quick reminder on how to use Promises with Node and Express in order to run potentially | |
* time-consuming jobs asynchronously (assuming the jobs are able to run in the background thanks to | |
* libuv and actually return Promises). | |
* | |
* Start the server, navigate to /startjob, then refresh a few times, the job should be in progress. | |
* You can navigate elsewhere in the "app" in other browser tabs in the meanwhile (/). After about | |
* 20s, you should get a result by refreshing the tab where you originally submitted the job. | |
* | |
* I hope this pattern will be useful e.g. for processing images with the `sharp` library (see | |
* <http://sharp.dimens.io>). |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 collections import Counter | |
import matplotlib as mpl | |
import matplotlib.pyplot as plt | |
import pandas as pd | |
import regex as re | |
from shiny import App, reactive, render, ui | |
mpl.rcParams.update( | |
{ |
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
// Some instances of E0499 ("cannot borrow X as mutable more than once | |
// at a time") are straightforward to understand, but some can be | |
// tricky. Among the latter ones (at least for me) are those related to | |
// the way a function potentially extends the lifetime of a borrow by | |
// tying it to another value. | |
// | |
// For instance, this function: https://github.com/benhoyt/countwords/blob/5318b1acdd5bd313039d480af535cf79565c2e62/rust/optimized-unsafe/main.rs#L72 | |
// | |
// Try changing it so that it accepts a &'a mut Vec<u8> instead of a | |
// &'a Cell<Vec<u8>>. You'll get the following error: |
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
#!/usr/bin/env python3 | |
"""Usage: {} AUTHOR_SUBSTRING INPUT.DOCX OUTPUT.DOCX | |
Remove date metadata from Word document for authors matching | |
AUTHOR_SUBSTRING. Handy if you don't want other people to know when | |
exactly you found time to work on their document ;) | |
In more detail: Read INPUT.DOCX, extract the comments and tracked edits, | |
manipulate them (cf. functions `modify_comments()` and | |
`modify_tracked_edits()` -- by default, they remove date metadata |
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
diff -ru a/src/main/java/mpi/eudico/client/annotator/player/VLCJMediaPlayer.java b/src/main/java/mpi/eudico/client/annotator/player/VLCJMediaPlayer.java | |
--- a/src/main/java/mpi/eudico/client/annotator/player/VLCJMediaPlayer.java 2016-01-14 16:44:42.000000000 +0100 | |
+++ b/src/main/java/mpi/eudico/client/annotator/player/VLCJMediaPlayer.java 2019-04-08 16:39:56.894874290 +0200 | |
@@ -597,6 +597,7 @@ | |
public void setOffset(long offset) { | |
logger.log(Level.FINE, "set offset {0}", offset); | |
this.timeOffset = offset; | |
+ mediaDescriptor.timeOrigin = offset; | |
} | |
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
(* SETUP | |
1. Create an Application in Automator. | |
2. Add a Run AppleScript action. | |
3. Paste the content of this gist instead of the provided script skeleton. | |
4. Save the app, drag it to your dock and/or set it as the default app for | |
the filetypes of your choice using the Open With dialog in Finder. | |
NOTES ON USAGE |
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
#!/usr/bin/env python3 | |
"""List packages explicitly installed with pacman or pacaur.""" | |
import re | |
from collections import namedtuple | |
from subprocess import check_output | |
Package = namedtuple("Package", "date name") |
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
// ==UserScript== | |
// @name KonText Interface Layout Switcher | |
// @namespace https://trnka.korpus.cz/~lukes | |
// @version 3.2.0 (for KonText v0.9.x) | |
// @description Adds a quick query box to KonText above the concordance | |
// @author David Lukeš | |
// @match https://kontext.korpus.cz/* | |
// @grant none | |
// @require http://code.jquery.com/jquery-latest.js | |
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js |
NewerOlder