Skip to content

Instantly share code, notes, and snippets.

View bradclawsie's full-sized avatar

Brad Clawsie bradclawsie

View GitHub Profile
@bradclawsie
bradclawsie / palindrome.pl
Created October 28, 2023 15:53
palindrime.pl
#!/usr/bin/env perl
# perl note - if @ds = [1,2,3], shift(@ds) returns 1 and make @ds be [2,3]
#
# perl note - perl lets you treat chars and numbers the same and just mostly
# figures out what to do
use v5.38;
# the input
my $t = '8155999';
@bradclawsie
bradclawsie / futures.pl
Created February 1, 2023 01:56
futures.pl
#!/usr/bin/env perl
use v5.36;
use Future::AsyncAwait;
use Future::IO;
use experimental qw( signatures );
async sub f($v) {
say 'start of f' . $v;
say time;
say 'a' . $v;
@bradclawsie
bradclawsie / lru.ts
Last active January 5, 2021 02:49
typescript lru
class lru {
size: number;
n: number;
key2val: Map<string, any>;
keys: string[];
constructor(size: number) {
this.size = size;
this.n = 0;
this.key2val = new Map<string,any>();
@bradclawsie
bradclawsie / tcc
Last active October 21, 2019 20:20
tcc
package main
// run this: https://play.golang.org/p/lGEbAcNeVJr
import (
"fmt"
"log"
)
const (
@bradclawsie
bradclawsie / flatten.go
Last active October 8, 2019 01:45
flatten.go
package main
// RUN IT! https://play.golang.org/p/hUrvvq_gBQX
import (
"fmt"
)
func flatten(iface interface{}) []int {
@bradclawsie
bradclawsie / counter_client.go
Created September 17, 2019 15:24
counter_client.go
package main
import (
"context"
"log"
"os"
"strconv"
"time"
pb "../counter"
@bradclawsie
bradclawsie / counter_server.go
Created September 17, 2019 15:21
counter_server.go
package main
import (
"context"
"errors"
"log"
"net"
"sync"
pb "../counter"
@bradclawsie
bradclawsie / counter.proto
Created September 17, 2019 14:54
counter.proto
syntax = "proto3";
package counter;
// Value contains a countername and its present value.
message Value {
string countername = 1;
int32 value = 2;
}
@bradclawsie
bradclawsie / channel-pool.go
Created January 16, 2018 06:14
channel-pool.go
package main
import (
"errors"
"log"
"math/rand"
"sync"
"time"
)

Keybase proof

I hereby claim:

  • I am bradclawsie on github.
  • I am b7j0c (https://keybase.io/b7j0c) on keybase.
  • I have a public key whose fingerprint is B1C1 F146 2CE7 6E5F 2D99 4FB3 D817 E42D CCB5 AB08

To claim this, I am signing this object: