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
| import numpy as np | |
| def correlate(data, kernel): | |
| # Set up data indexes to use in the kernel multiplication broadcast. | |
| # let len(data) = 1000 and len(kernel) = 5 | |
| # array([[ 0, 1, 2, 3, 4], | |
| # [ 1, 2, 3, 4, 5], | |
| # [ 2, 3, 4, 5, 6], | |
| # ..., |
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
| #!/usr/bin/env python | |
| def merge_sort(unsorted_arr): | |
| if len(unsorted_arr) < 2: | |
| return unsorted_arr | |
| # Pivot into left and right | |
| pivot = len(unsorted_arr) // 2 | |
| left = unsorted_arr[:pivot] |
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
| pip==21.3.1 | |
| tensorflow==2.7.0 | |
| - absl-py [required: >=0.4.0, installed: 1.0.0] | |
| - six [required: Any, installed: 1.16.0] | |
| - astunparse [required: >=1.6.0, installed: 1.6.3] | |
| - six [required: >=1.6.1,<2.0, installed: 1.16.0] | |
| - wheel [required: >=0.23.0,<1.0, installed: 0.37.0] | |
| - flatbuffers [required: >=1.12,<3.0, installed: 2.0] | |
| - gast [required: >=0.2.1,<0.5.0, installed: 0.4.0] | |
| - google-pasta [required: >=0.1.1, installed: 0.2.0] |
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
| import json | |
| from typing import MutableSequence | |
| from typing import Mapping | |
| from copy import deepcopy | |
| def walk_nested(obj, keys=None): | |
| # Default for keys. | |
| if keys is None: | |
| keys = [] |
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
| #include<stdio.h> | |
| #include<stdlib.h> | |
| int main(void) { | |
| int *ptr = calloc(5, sizeof(int)); | |
| printf("sizeof(ptr) = %ld\n", sizeof(ptr)); | |
| for (void *end = &ptr[5]; ptr != end; ptr++) |
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 | |
| import ( | |
| "fmt" | |
| "image" | |
| "image/color" | |
| "image/png" | |
| "os" | |
| ) |
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 | |
| import ( | |
| "sync/atomic" | |
| "log" | |
| "time" | |
| ) | |
| func main() { | |
| msgs := make(chan struct{}) |
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 | |
| import ( | |
| "os" | |
| "fmt" | |
| ) | |
| func Args() []string{ | |
| args := make([]string, len(os.Args), 100) | |
| fmt.Printf("os.Args: %v\n", os.Args) |
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
| build: # builds defualt.nix | |
| nix-build | |
| clean: | |
| find -type l -exec sh -c 'main(){ \ | |
| local drv=$$(nix-store -q --roots $$1 | cut -d " " -f 3); \ | |
| rm $$1 && nix-store --delete $$drv; \ | |
| }; main $$1' sh {} \; |