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
# Function to download the tar file | |
function Download-NixOS { | |
$url = "https://github.com/nix-community/nixos-wsl/releases/latest/download/nixos-wsl.tar.gz" | |
$output = "$env:TEMP\nixos-wsl.tar.gz" | |
Invoke-WebRequest -Uri $url -OutFile $output | |
return $output | |
} | |
# Function to check if WSL is installed and install if it's not | |
function Install-WSL { |
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
# Setup WSL | |
wsl --update | |
wsl --install -d Debian | |
# Enter WSL | |
wsl | |
# Setup base system | |
sudo apt update | |
sudo apt install -y --no-install-recommends apt-transport-https ca-certificates curl gnupg2 vim |
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
type errs []error | |
func (e errs) Error() string { | |
s := make([]string,len(e)) | |
for i, err := range e { | |
s[i] = err.Error() | |
} | |
return strings.Join(s,",") | |
} |
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 | |
//#include "capture.h" | |
import "C" | |
import ( | |
"bufio" | |
"fmt" | |
"log" | |
"os" | |
"sync" |
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
//dump jpeg | |
curl "http://10.41.3.120/cgi-bin/faststream.jpg?stream=MxPEG&fps=0.1" | mxgconv_linux format=jpeg,of=img | |
//split images | |
find ./ | grep jpg |xargs -I@ convert -quality 100 -crop 640x480 @ @_cropped_%d.jpg | |
//preserve original filename in images | |
ls | xargs -I@ echo exiftool -Comment=@ @ | |
//rename file to md5sum name |
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
// A []C.int64_t slice backed by C memory. | |
// See: https://github.com/golang/go/wiki/cgo#turning-c-arrays-into-go-slices | |
// Using [1<<27] instead of [1<<30] so it works on 32-bit architecture |
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
#!/bin/bash | |
find /path/to/JPEGImages | grep jpg$ | shuf > files.list | |
cat files.list | wc -l | |
#180 = 10% | |
cat files.list | head -n 180 > test.txt | |
#rest goes into train.txt | |
cat files.list | grep -v -f test.txt > train.txt |
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
interface Subscription<T> { | |
id: number, | |
type: new () => T | |
fn: (event:T)=>any | |
} | |
class Bus { | |
private seq:number = 0; | |
private subscribers:Map<string,Array<Subscription<any>>> = new Map(); |
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
/* RETRANSMISSION/FAST RETRANSMISSION/OUT-OF-ORDER | |
* If the segment contains data (or is a SYN or a FIN) and | |
* if it does not advance the sequence number, it must be one | |
* of these three. | |
* Only test for this if we know what the seq number should be | |
* (tcpd->fwd->nextseq) | |
* | |
* Note that a simple KeepAlive is not a retransmission | |
*/ | |
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
#!/bin/bash | |
ls *.000 | xargs -I @ bash -c "ogrinfo @ | awk '{if(NR>3)print \$2}' | xargs -I xxx ogr2ogr -f \"GeoJSON\" @_xxx.geojson @ xxx" |
NewerOlder