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/local/bin/python | |
# coding: utf-8 | |
# for windows get ldap module here: http://www.lfd.uci.edu/~gohlke/pythonlibs/#python-ldap | |
# python_ldap‑2.4.21‑cp27‑none‑win_amd64.whl | |
## debugging in ipython: https://github.com/gotcha/ipdb | |
# debug in in ipython repl with: run -d 'test_ldap2.py' or %run ... | |
# debug it in ipython repl with: ipdb.runcall(run_filter, Server, DN, Secret, un) |
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
In your local clone of your forked repository, you can add the original GitHub repository as a "remote". ("Remotes" are like nicknames for the URLs of repositories - origin is one, for example.) Then you can fetch all the branches from that upstream repository, and rebase your work to continue working on the upstream version. In terms of commands that might look like: | |
# Add the remote, call it "upstream": | |
git remote add upstream https://github.com/whoever/whatever.git | |
# Fetch all the branches of that remote into remote-tracking branches, | |
# such as upstream/master: | |
git fetch upstream |
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
x = MyClass | |
# pre ruby 2.0 | |
def eigenclass? | |
Class === x && x.ancestors.first != x | |
end | |
# post ruby 2.0 | |
def eigenclass? |
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
# usage: | |
# | |
# . 3_fingered_claw.sh | |
# try command1 | |
# try command2 | |
yell() { echo "$0: $*" >&2; } | |
die() { yell "$*"; exit 111; } | |
try() { "$@" || die "cannot $*"; } |
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
# If you are going to deploy say on a debian linux box with upstart you can use my script from the juju charm: | |
cat /etc/init/app_name.conf | |
description "app_name Vert.x server" | |
start on (net-device-up | |
and local-filesystems | |
and runlevel [2345]) | |
stop on runlevel [!2345] |
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
cd ~/Library/Application\ Support/IntelliJIdea2016.1/NativeNeighbourhood/classes/org/intellij/plugins/nativeNeighbourhood/icons/macosx | |
echo '#!/bin/sh | |
# | |
# Reveal a directory in the Terminal. | |
# | |
# The script takes one argument, the qualified name of a directory. | |
# | |
# Note that the script is necessary because osascript before osx 10.4 could not | |
# pass arguments. |
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
find . -name "node_modules" -exec rm -rf '{}' + |
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
log4j.debug=false | |
# Default level is INFO | |
log4j.rootLogger=INFO,StdoutErrorFatal,StdoutWarn,StdoutInfo,StdoutDebug,StdoutTrace | |
# and for com.some.package.* log everything | |
log4j.logger.com.some.package=TRACE | |
log4j.appender.StdoutErrorFatal=org.apache.log4j.ConsoleAppender | |
log4j.appender.StdoutErrorFatal.layout=org.apache.log4j.PatternLayout |
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
annotations could be fine for your purpose. | |
@FileProperties(desc="data file") | |
public class DataFile extends XFile { ... } | |
FileProperties props = DataFile.class.getAnnotation(FileProperties.class); | |
String desc = props.desc(); | |
Accessing the info still requires reflection, however it's a little better than using static field/method. | |
Java compiler does not enforce that all subclasses are annotated as such. You can add your logic to the compiler (using annotation processing) but that's too complicated. It's ok to check it at runtime. |
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
If we view the series of events as a “sentence”, we could use this technique to vectorize them: | |
https://cs.stanford.edu/~quocle/paragraph_vector.pdf | |
Very good svm introductory text: | |
http://karpathy.github.io/neuralnets/ | |
This site is also good: | |
http://deeplearning4j.org |