This file contains hidden or 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
| [shivam@smg ~]$ webots | |
| Fontconfig warning: FcPattern object weight does not accept value [40 210) | |
| /snap/webots/12/usr/share/webots/webots: line 69: 89715 Segmentation fault (core dumped) "$webots_home/bin/webots-bin" "$@" |
This file contains hidden or 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
| gazebo: | |
| ubuntu: | |
| xenial: [gazebo9] | |
| gazebo_ros: | |
| ubuntu: | |
| xenial: [ros-kinetic-gazebo9-ros] |
This file contains hidden or 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
| package main | |
| type VarSum func(a ...int) interface{} | |
| func curry(fn func(x, y, z int) int, args ...int) interface{} { | |
| if len(args) >= 3 { | |
| return fn(args[0], args[1], args[2]) | |
| } | |
| return VarSum(func(more ...int) interface{} { | |
| args = append(args, more...) |
This file contains hidden or 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
| <domain> ::= <subdomain> | " " | |
| <subdomain> ::= <label> | <subdomain> "." <label> | |
| <label> ::= <letter> [ [ <ldh-str> ] <let-dig> ] | |
| <ldh-str> ::= <let-dig-hyp> | <let-dig-hyp> <ldh-str> | |
| <let-dig-hyp> ::= <let-dig> | "-" |
This file contains hidden or 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
| Grammar with left-recursion (e.g. Expr's derivation contains Expr as first non-terminal). | |
| Not suitable for Recursive Descent parsing. | |
| Expr = Expr "+" Term | Expr "-" Term | Term | |
| Term = Term "*" Factor | Term "/" Factor | Factor | |
| Factor = "(" Expr ")" | "-" Factor | Number |
This file contains hidden or 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
| git clone github.com/go-openapi/spec && cd spec | |
| # we need to know what commit was `PathLoader` added to the `spec` pkg | |
| git bisect start --term-old not-defined --term-new defined | |
| git bisect not-defined cb9ba12 # first commit | |
| git bisect defined master | |
| git bisect run isdefined.sh |
This file contains hidden or 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
| def binary_search(arr, start, end, target): | |
| if start > end: | |
| # target does not exist in arr | |
| return start # index of the next greater element than target | |
| mid = (start + end) // 2 | |
| if arr[mid] == target: | |
| return mid | |
| if arr[mid] > target: | |
| return binary_search(arr, start, mid-1, target) | |
| return binary_search(arr, mid+1, end, target) |
This file contains hidden or 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
| class GraphBellmanFord(Graph): | |
| def bellman_ford(self, src: str): | |
| dist = {} | |
| for _, u in self.V.items(): | |
| dist[u] = float('Inf') | |
| src = self.V[src] | |
| dist[src] = 0 | |
| edges = [] | |
| for e in self.E.values(): |
This file contains hidden or 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
| # Total possible values in array | |
| # Array can only be sorted if it's in range [0, K) | |
| K = 10 | |
| def counting_sort(arr): | |
| counter = [0 for _ in range(K)] | |
| for a in arr: | |
| counter[a] += 1 |
This file contains hidden or 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
| class MinHeap: | |
| """A min-heap using an array""" | |
| # storing tree in level-order | |
| arr = [] | |
| @staticmethod | |
| def parent(i): return (i - 1) // 2 | |
| @staticmethod | |
| def children(i): return (2*i + 1, 2*i + 2) | |
| def insert(self, a): |