Skip to content

Instantly share code, notes, and snippets.

View chrisgoffinet's full-sized avatar
💭
Available

Chris Goffinet chrisgoffinet

💭
Available
View GitHub Profile
@chrisgoffinet
chrisgoffinet / dropbox.sh
Created May 6, 2022 23:18
[cron] Automatically ignore node_modules in Dropbox
#!/bin/sh
# * * * * * ~/bin/dropbox.sh >/dev/null 2>&1
echo "Dropbox: ignoring node_modules..."
find ~/Dropbox -name "node_modules" -prune -exec echo {} \; -exec xattr -w com.dropbox.ignored 1 '{}' +
aws iam generate-service-last-accessed-details \
--arn <arn> --granularity ACTION_LEVEL
# Get tne jobID
aws iam get-service-last-accessed-details --job-id <jobID> > output.json
@chrisgoffinet
chrisgoffinet / gql.py
Last active February 23, 2022 04:47
Example code using gql and pagination
from gql import gql, Client
from gql.transport.requests import RequestsHTTPTransport
from gql.dsl import DSLQuery, DSLSchema, dsl_gql
import os
base_url = 'https://api.linear.app/graphql'
token = os.getenv('LINEAR_TOKEN')
transport = RequestsHTTPTransport(url=base_url, headers={
'Authorization': 'Bearer ' + token})
@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"
@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 / 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 / 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"
// example of counting semaphore to control fixed no. of goroutines
package main
import (
"fmt"
"time"
)
func main() {
@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."
@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: