Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
""" | |
Allows to split a dictionary into chunks of equal size. If the length of the dictionary is not divisible by the chunk | |
size, the last chunk will be smaller. For example, if the length of the dictionary is 10 and the chunk size is 4, | |
then we'll have three chunks: two of size 4 and one of size 2. | |
The first function returns a list with the dictionaries and the second one creates a generator. | |
""" | |
def split_dictionary(input_dict, chunk_size): |
/** | |
* A Sitemap controller that automatically generates sitemap.xml for a grails website. | |
* | |
* Be sure to notice the controllerNamesToExclude and actionsToExclude lists | |
* | |
* References: | |
* http://stackoverflow.com/questions/3748125/xml-sitemap-in-grails | |
* http://stackoverflow.com/questions/2956294/reading-out-all-actions-in-a-grails-controller | |
* | |
*/ |
type below:
brew update
brew install redis
To have launchd start redis now and restart at login:
brew services start redis
$ curl --help | |
Usage: curl [options...] <url> | |
--abstract-unix-socket <path> Connect via abstract Unix domain socket | |
--alt-svc <file name> Enable alt-svc with this cache file | |
--anyauth Pick any authentication method | |
-a, --append Append to target file when uploading | |
--basic Use HTTP Basic Authentication | |
--cacert <file> CA certificate to verify peer against | |
--capath <dir> CA directory to verify peer against | |
-E, --cert <certificate[:password]> Client certificate file and password |
[alias] | |
co = checkout | |
cob = checkout -b | |
coo = !git fetch && git checkout | |
br = branch | |
brd = branch -d | |
brD = branch -D | |
merged = branch --merged | |
st = status | |
aa = add -A . |
java.lang.ClassNotFoundException: javafx.util.Pair
happens because javafx.util.Pair
and other classes from javafx.util
are not included in OpenJDK. Options for resolving:
Map.Entry<K, V>
from java.util
is similar to javafx.util.Pair
.
Install java-openjfx
through your package manager. (or whatever means you used to install Java on your machine) Note that java-openjfx
is compatible with OpenJDK8, not previous versions.
After installing java-openjfx
, you may have to add it manually to your IDE SDK classpath. Eg in IntelliJ, you may have to go to Project Structure
| SDKs
| <select your SDK>
| Classpath
| +
(the Classpath +
, not the SDKs +
) | and add /usr/lib/jvm/java-8-openjdk/jre/lib/ext/jfxrt.jar
(which should be there now that java-openjfx
has been installed) | OK
package se.wendt.statoil.mastercard; | |
import java.util.ArrayList; | |
import java.util.concurrent.CountDownLatch; | |
import redis.clients.jedis.Jedis; | |
import redis.clients.jedis.JedisPubSub; | |
public class JedisTest { |
import java.nio.channels.FileLock | |
final file = new RandomAccessFile(new File("foo.lock"), "rw") | |
println "<Entering in critical section>" | |
try { | |
/* | |
* wait to acquire a lock | |
*/ | |
def secs = 0 | |
FileLock lock |
# Visualizing branch topology in git on the commandline | |
git log --graph --oneline --full-history --all | |
git log --graph --full-history --all --pretty=format:"%h%x09%d%x20%s" | |
# With colors in Bash: | |
git log --graph --full-history --all --color --pretty=format:"%x1b[31m%h%x09%x1b[32m%d%x1b[0m%x20%s" |