When publishing to a personal Git repo instead of to crates.io, you use git URLs to refer to the deps in Cargo.toml.
Example:
[dependencies]
mything = { git = "ssh://git@github.com/andreweduffy/mything.git" }
| // Solution to the interview question of finding ideal purchase/sale times and profits for | |
| // a history of a single stock, in Go | |
| package main | |
| import "fmt" | |
| // Finds the maximum profit to be had from buying and selling at a given price | |
| func MaxProfit(prices []int) (buy int, sell int, profit int) { | |
| profit = 0 |
| package main | |
| import "golang.org/x/tour/tree" | |
| import "fmt" | |
| // Walk walks the tree t sending all values | |
| // from the tree to the channel ch. | |
| func Walk(t *tree.Tree, ch chan int) { | |
| walk(t, ch) | |
| close(ch) |
| // should make a SIGSEGV, which can be caught | |
| // Purpose of this is to see how you can use tricks like this | |
| // to create distributed shared memory that is demand faulted | |
| // into memory from off the network. | |
| #include <sys/mman.h> | |
| #include <stdlib.h> | |
| #include <fcntl.h> | |
| #include <strings.h> | |
| #include <string.h> | |
| #include <errno.h> |
| object URLExtractor { | |
| // Takes a URL formatted as a string, extracts out the scheme, host and path | |
| def unapply(url: String): Option[(String, String, String)] = { | |
| val (scheme, rest) = url.split("://") match { | |
| case Array(scheme, rest) => (scheme, rest) | |
| case _ => ("", "") | |
| } | |
| if (scheme.isEmpty || rest.isEmpty) | |
| None |
| def find_rotation(arr): | |
| """ | |
| Finds the rotation point of a list of length N in time O(lg(N)) | |
| Ex: [4,5,6,1,2,3] -> 3 | |
| """ | |
| def _find_rotation(arr, start, end): | |
| mid = int(start + (end - start) / 2) | |
| if start == end: | |
| return start |
| /** | |
| * mm-test: A simple test of using mmap() to manipulate files as if they are | |
| * regions of memory. This example has full error checking, and allows the user | |
| * to specify a file, as well as replacement text and an optional offset value. | |
| * | |
| * Andrew Duffy, 2016 | |
| */ | |
| #include <fcntl.h> | |
| #include <stdio.h> | |
| #include <stdlib.h> |
| // httpfs Performs GET requests when reading a file. | |
| // Compile with `go build httpfs.go` and then run with `./httpfs /http`, | |
| // then try doing `cat /http/aduffy.org` | |
| package main | |
| import ( | |
| "flag" | |
| "io/ioutil" | |
| "log" | |
| "net/http" |
| #!/usr/bin/env ruby | |
| =begin | |
| Flash -- Check a set of sites to see links matching queries | |
| Requirements: | |
| Mechanize | |
| Ruby (I'm on 2.0.0, not a ruby expert) | |
| This script just scrapes a given set of news sources for links matching a query. |
| """ | |
| Solution to Beautiful Pairs HackerRank challenge. | |
| Challenge: Given two input arrays, A and B, find the maximal number of disjoint pairs (i, j) where A[i] = B[j], | |
| after one element from B is changed. The change can be anything you wish, though it must happen. | |
| Description of Solution: | |
| - Let Ca[k] = number of occurrences of k in A | |
| - Let Cb[k] = number of occurrences of k in B | |
| - for each k in Ca: |