Skip to content

Instantly share code, notes, and snippets.

@ags313
ags313 / gitmeup.go
Created June 29, 2022 23:02
Update git repositories recursively
package main
import (
"bytes"
"fmt"
"io/ioutil"
"os"
"os/exec"
"path"
"path/filepath"
package main
import (
"sync/atomic"
"runtime"
"sync"
"time"
"fmt"
)
package main
// this is BROKEN
// do NOT copy
func main() {
var aMap = map[string]int64{}
aMap["a"] = 1
@ags313
ags313 / gist:7d50ae03aae732ef5068
Created February 27, 2015 14:38
A coding puzzle!
A DNA sequence can be represented as a string consisting of the letters A, C, G and T, which correspond to the types of successive nucleotides in the sequence. Each nucleotide has an impact factor, which is an integer. Nucleotides of types A, C, G and T have impact factors of 1, 2, 3 and 4, respectively. You are going to answer several queries of the form: What is the minimal impact factor of nucleotides contained in a particular part of the given DNA sequence?
The DNA sequence is given as a non-empty string S = S[0]S[1]...S[N-1] consisting of N characters. There are M queries, which are given in non-empty arrays P and Q, each consisting of M integers. The K-th query (0 ≤ K < M) requires you to find the minimal impact factor of nucleotides contained in the DNA sequence between positions P[K] and Q[K] (inclusive).
For example, consider string S = CAGCCTA and arrays P, Q such that:
P[0] = 2 Q[0] = 4
P[1] = 5 Q[1] = 5
P[2] = 0 Q[2] = 6
The answers to these M = 3 queries are as follows:

Keybase proof

I hereby claim:

  • I am ags313 on github.
  • I am ags (https://keybase.io/ags) on keybase.
  • I have a public key whose fingerprint is 0030 CA32 8B49 CBBD 52D9 72E6 79EB E5A3 D6E7 58E4

To claim this, I am signing this object: