Operation | Input | Result | Notes |
---|---|---|---|
map | F[A] , A => B |
F[B] |
Functor |
apply | F[A] , F[A => B] |
F[B] |
Applicative |
(fa, fb, ...).mapN | (F[A], F[B], ...) , (A, B, ...) => C |
F[C] |
Applicative |
(fa, fb, ...).tupled | (F[A], F[B], ...) |
F[(A, B, ...)] |
Applicative |
flatMap | F[A] , A => F[B] |
F[B] |
Monad |
traverse | F[A] , A => G[B] |
G[F[A]] |
Traversable; fa.traverse(f) == fa.map(f).sequence ; "foreach with effects" |
sequence | F[G[A]] |
G[F[A]] |
Same as fga.traverse(identity) |
. | . | . | . |
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
Welcome to the Ammonite Repl 0.8.0 | |
(Scala 2.11.8 Java 1.8.0_91) | |
@ import scala.util.Try | |
import scala.util.Try | |
@ val listOfTries: List[Try[String]] = List(Try("a"), Try("b"), Try("c")) | |
listOfTries: List[Try[String]] = List(Success("a"), Success("b"), Success("c")) | |
// I have a List[Try[String]] but I actually want a Try[List[String]]. |
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
# There are 3 levels of git config: global, project, and system. | |
# global: Global configs are available for all projects for the current user and stored in ~/.gitconfig. | |
# project: Project configs are only available for the current project and stored in .git/config in the project's directory. | |
# system: System configs are available for all the users/projects and stored in /etc/gitconfig. | |
# Create a global config | |
$ git config --global user.name "John Doe" | |
# Create a project specific config, you have to execute this under the project's directory. |
- Siri, Write the Next Method
- Code Prediction by Feeding Trees to Transformers
- Towards Automating Code Review Activities
- Traceability Transformed: Generating more Accurate Links with Pre-Trained BERT Models
- Studying the Usage of Text-To-Text Transfer Transformer to Support Code-Related Tasks
- A Context-based Automated Approach for Method Name Consistency Checking and Suggestion
- [GUIGAN: Learning to Generate GUI Designs Using Generative Adversarial Networks](https://www.co
The repository for the assignment is public and Github does not allow the creation of private forks for public repositories.
The correct way of creating a private frok by duplicating the repo is documented here.
For this assignment the commands are:
- Create a bare clone of the repository.
(This is temporary and will be removed so just do it wherever.)
git clone --bare git@github.com:usi-systems/easytrace.git
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
# | |
# Original solution via StackOverflow: | |
# http://stackoverflow.com/questions/35802939/install-only-available-packages-using-conda-install-yes-file-requirements-t | |
# | |
# | |
# Install via `conda` directly. | |
# This will fail to install all | |
# dependencies. If one fails, | |
# all dependencies will fail to install. |
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
# For Windows users# Note: <> denotes changes to be made | |
#Create a conda environment | |
conda create --name <environment-name> python=<version:2.7/3.5> | |
#To create a requirements.txt file: | |
conda list #Gives you list of packages used for the environment | |
conda list -e > requirements.txt #Save all the info about packages to your folder |
Action | tmux | screen |
---|---|---|
start a new session | tmux tmux new tmux new-session |
screen |
start a new session with a name | tmux new -s name | screen -S name |
re-attach a detached session | tmux attach tmux attach-session |
screen -r |
re-attach a detached session with a name | tmux attach -t name tmux a -t name |
screen -r name |
re-attach an attached session (detaching it from elsewhere) | tmux attach -dtmux attach-session -d | screen -dr |
I recently came across the need to spawn multiple threads, each of which needs to write to the same file. Since the file will experience contention from multiple resources, we need to guarantee thread-safety.
NOTE: The following examples work with Python 3.x. To execute the following programs using Python 2.7, please replace threading.get_ident()
with thread.get_ident()
. As a result, you would need to import thread
and not threading
.
- (The following example will take a very long time). It will create 200 threads, each of which will wait until a global lock is available for acquisition.
# threading_lock.py
import threading
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
# Sample PBS job script | |
# | |
# Copy this script, customize it and then submit it with the ``qsub'' | |
# command. For example: | |
# | |
# cp pbs-template.sh myjob-pbs.sh | |
# {emacs|vi} myjob-pbs.sh | |
# qsub myjob-pbs.sh | |
# | |
# PBS directives are fully documented in the ``qsub'' man page. Directives |
OlderNewer