Skip to content

Instantly share code, notes, and snippets.

View kaipyroami's full-sized avatar
🦆

Kyle Crockett kaipyroami

🦆
View GitHub Profile

Keybase proof

I hereby claim:

  • I am kaipyroami on github.
  • I am kaipyroami (https://keybase.io/kaipyroami) on keybase.
  • I have a public key ASAIoob93z2FMH2d1beZKZ8ko4OTaNXyXC-3dFZv-HZE-wo

To claim this, I am signing this object:

@kaipyroami
kaipyroami / zipifnot.sh
Created October 22, 2020 02:55
If it is not zipped then zip it, test integrity and delete original.
#!/bin/sh
find . -type f \( -iname "*" ! -iname "*.zip" \) -execdir zip -m -T '{}.zip' '{}' \;
@kaipyroami
kaipyroami / docker-compose.yml
Created September 11, 2020 03:18
A simple docker compose file to run a Pharos container.
# Pharos - https://github.com/cmu-sei/pharos
version: '3.7'
services:
pharos:
container_name: pharos
image: seipharos/pharos
volumes:
- ./data:/pharos-data
restart: unless-stopped
@kaipyroami
kaipyroami / lookup2d.go
Last active September 9, 2019 15:58
This is a simple example of a 2 dimensional lookup table with linear interpolation in Go.
package main
import (
"fmt"
)
func main() {
var yi1, yi2, xi1, xi2 int // Lookup table indexes around point
var x, y float64 // x,y axis values at indexes
@kaipyroami
kaipyroami / lookup1d.go
Created September 9, 2019 02:47
This is a simple example of a 1 dimensional lookup table with linear interpolation in Go.
// This is a simple example of a 1 dimensional lookup table with linear interpolation.
package main
import (
"fmt"
)
type table struct {
axis []float64
values []float64
@kaipyroami
kaipyroami / channelRangeEx.go
Created September 4, 2019 21:53
An example of a channel being piped into a range loop in Go.
package main
import (
"fmt"
)
func main() {
c := make(chan int)
go func() {
@kaipyroami
kaipyroami / channelBufEx.go
Created September 4, 2019 18:36
Channel example using a buffer.
package main
import (
"fmt"
)
func main() {
c := make(chan int, 1) // Buffer
@kaipyroami
kaipyroami / channelFuncEx.go
Created September 4, 2019 18:34
Channel using function example.
package main
import (
"fmt"
)
func main() {
c := make(chan int)
@kaipyroami
kaipyroami / atomicEx.go
Created September 4, 2019 16:57
An example of an atomic counter in Go.
package main
import (
"fmt"
"sync"
"sync/atomic"
)
func main() {
@kaipyroami
kaipyroami / mutexEx.go
Created September 4, 2019 16:32
Just a simple example of a mutex during race condition.
package main
import (
"fmt"
"runtime"
"sync"
)
func main() {