start new:
tmux
start new with session name:
tmux new -s myname
class Graph: | |
def __init__(self): | |
self.nodes = set() | |
self.edges = defaultdict(list) | |
self.distances = {} | |
def add_node(self, value): | |
self.nodes.add(value) | |
def add_edge(self, from_node, to_node, distance): |
/* | |
Serve is a very simple static file server in go | |
Usage: | |
-p="8100": port to serve on | |
-d=".": the directory of static files to host | |
Navigating to http://localhost:8100 will display the index.html or directory | |
listing file. | |
*/ | |
package main |
func ComputeHmac256(message string, secret string) string { | |
key := []byte(secret) | |
h := hmac.New(sha256.New, key) | |
h.Write([]byte(message)) | |
return base64.StdEncoding.EncodeToString(h.Sum(nil)) | |
} |
This is an interactive Map of the Administrative divisions of Bogotá, made with TopoJSON and D3.
Inspired by the Mexican municipalities map, it shows the Administrative division of Colombia's capital city.
Bogotá has 20 localities and each of them is compound of smaller divisions called Barrios. There are 1900 Barrios in Bogotá
It uses TopoJSON to diferentiate the Departments boundaries through the function topojson.mesh and a special filter.
To obtain the TopoJSON, first I converted the .shp file of the Municipality divition of Colombia by Maurix Suárez to GeoJSON, using:
System: Debian/Ubuntu/Fedora. Might work for others as well.
As mentioned here, to update a go version you will first need to uninstall the original version.
To uninstall, delete the /usr/local/go
directory by:
# use the latest ubuntu environment (18.04) available on travis | |
dist: bionic | |
language: go | |
# You don't need to test on very old versions of the Go compiler. It's the user's | |
# responsibility to keep their compiler up to date. | |
go: | |
- 1.16.x |
Though we're focused more on server setup procedure in this document, I will still give a very brief explanation in laymen terms for ELK. To those who are starting new in this stack, must have already heard of MVC (Model View Controller), so take it like this:
=>
Elasticsearch (for Storage, Indexing & Search)=>
Kibana (for DataViz & G-Man, yeah the one in half life 😏)=>
Logstash (For Logs & Filtering)mapping (address => mapping (bytes32 => bool)) public orders; | |
mapping (address => mapping (bytes32 => uint)) public orderFills; | |
function trade(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce, address user, uint8 v, bytes32 r, bytes32 s, uint amount) { | |
bytes32 hash = sha256(this, tokenGet, amountGet, tokenGive, amountGive, expires, nonce); | |
if (!( | |
(orders[user][hash] || ecrecover(sha3("\x19Ethereum Signed Message:\n32", hash),v,r,s) == user) && | |
block.number <= expires && | |
safeAdd(orderFills[user][hash], amount) <= amountGet | |
)) throw; |