Skip to content

Instantly share code, notes, and snippets.

View chrisgoffinet's full-sized avatar
💭
Available

Chris Goffinet chrisgoffinet

💭
Available
View GitHub Profile
package main
import (
"fmt"
"sync"
"time"
)
func main() {
var count = 100
@chrisgoffinet
chrisgoffinet / ratelimit.go
Created August 16, 2018 16:17
Rate Limit
package main
import (
"context"
"fmt"
"time"
"golang.org/x/time/rate"
)
package main
import (
"fmt"
"io/ioutil"
"net/http"
"time"
)
func main() {
@chrisgoffinet
chrisgoffinet / keybase.md
Created August 20, 2018 20:32
keybase.md

Keybase proof

I hereby claim:

  • I am chrisgoffinet on github.
  • I am chrisgoffinet (https://keybase.io/chrisgoffinet) on keybase.
  • I have a public key ASD0FhRalKeV3jRqPYgKJ9D97L1hRo7uSE-g_enheeR3TQo

To claim this, I am signing this object:

@chrisgoffinet
chrisgoffinet / docker.bash
Created August 29, 2018 22:46
docker helper
#!/bin/bash
set -euo pipefail
CMD="$1"
login()
{
if [ -z "${DOCKER_USER:-}" ] || [ -z "${DOCKER_PASS:-}" ]; then
echo "Please set DOCKER_USER and DOCKER_PASS environment variables."
// example of counting semaphore to control fixed no. of goroutines
package main
import (
"fmt"
"time"
)
func main() {
@chrisgoffinet
chrisgoffinet / main.go
Last active October 8, 2018 02:54
Upload to S3 using PerRequestContext
package main
import (
"context"
"fmt"
"log"
"os"
"time"
"github.com/aws/aws-sdk-go-v2/aws"
@chrisgoffinet
chrisgoffinet / httpTCPkeepalive.go
Last active December 14, 2020 18:59
set custom tcp keepAlive timeout on http server
package main
import (
"context"
"fmt"
"log"
"net"
"net/http"
"time"
)
@chrisgoffinet
chrisgoffinet / .bash_profile
Created December 21, 2020 09:12
bash profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
export EDITOR="code --wait"
function parse_git_branch {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
@chrisgoffinet
chrisgoffinet / fcc.zsh
Created January 1, 2022 04:48
access clipboard using zsh + maccy
fcc() {
DB=~/Library/Containers/org.p0deje.Maccy/Data/Library/Application\ Support/Maccy/Storage.sqlite
SQL="select distinct ZVALUE
from ZHISTORYITEMCONTENT
where ZTYPE IN ('public.text','public.utf8-plain-text')
order by Z_PK desc"
if ! [ -r "$DB" ]; then
MSG='Maccy database not found. "brew cask install maccy" to install Maccy.'
echo "$MSG"