Skip to content

Instantly share code, notes, and snippets.

View piotrkubisa's full-sized avatar
🐱
Set status

Piotr Kubisa piotrkubisa

🐱
Set status
View GitHub Profile
@piotrkubisa
piotrkubisa / ublock-origin.txt
Created July 13, 2023 12:42
Remove overlay SVG to fix bug causing top 5 rows of table to not be clickable in Data Studio / Looker Studio
lookerstudio.google.com##.metric-axis-holder:style(display: none)
package model
import (
"bytes"
"crypto/aes"
"crypto/cipher"
"crypto/hmac"
"crypto/rand"
"crypto/sha256"
"encoding/base64"
@piotrkubisa
piotrkubisa / Makefile
Created January 18, 2019 11:38
A prompt check in the Makefile
clean:
git clean -ndX
bash -c "read -r -p \"Are you sure? [y/N]\" response; [[ \$$response =~ [yY] ]] && git clean -dXi"
@piotrkubisa
piotrkubisa / request_test.go
Last active January 23, 2018 17:54
Simple test for checking if `omitBasePath` implementation worked as expected. My PR submission for apex/gateway.
package gateway
import "testing"
// omitBasePath strips out the base path from the given path.
//
// It allows to support both API endpoints (default, auto-generated
// "execute-api" address and configured Base Path Mapping
// with a Custom Domain Name), while preserving the same routing
// registered on the http.Handler.
package server
import (
"encoding/base64"
"encoding/json"
"io/ioutil"
"log"
"net"
"net/http"
"net/url"
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Console]
"ColorTable00"=dword:000c0c0c
"ColorTable01"=dword:00da3700
"ColorTable02"=dword:000ea113
"ColorTable03"=dword:00dd963a
"ColorTable04"=dword:001f0fc5
"ColorTable05"=dword:00981788
"ColorTable06"=dword:00009cc1
@piotrkubisa
piotrkubisa / strip_leading_slash_middleware.go
Created September 29, 2017 11:12
StripLeadingSlashes for chi
package server
func StripLeadingSlashes(next http.Handler) http.Handler {
fn := func(w http.ResponseWriter, r *http.Request) {
var path string
rctx := chi.RouteContext(r.Context())
if rctx.RoutePath != "" {
path = rctx.RoutePath
} else {
path = r.URL.Path
@piotrkubisa
piotrkubisa / newrelic-browser.d.ts
Last active January 25, 2018 12:25
TypeScript declaration file with the NewRelic Browser typings.
// Type definitions for NewRelicBrowser v1026
// Project: https://docs.newrelic.com/docs/browser/new-relic-browser/browser-agent-spa-api
// Definitions by: Piotr Kubisa <https://gist.github.com/piotrkubisa/4a1cc7355afcec46651a896d59ec8d50>
declare var newrelic: NewRelicBrowser;
interface NewRelicBrowser {
addPageAction(name: string, attributes: any): void;
addRelease(release_name: string, release_id: string): void;
addToTrace(custom_object: any): void;
@piotrkubisa
piotrkubisa / calc.go
Last active August 29, 2017 20:08
Benchmark - Calculate the Content-length from io.Reader stream
package calc
import (
"bytes"
"io"
"io/ioutil"
)
func BufferLen(r io.Reader) int {
var buf bytes.Buffer
@piotrkubisa
piotrkubisa / permissions.bash
Created September 22, 2016 21:25 — forked from pjdietz/permissions.bash
Set file and directory permissions with find, xargs, chmod
# Set all directories to 755, all files to 644.
find -type d -print0 | xargs -0 chmod 755
find -type f -print0 | xargs -0 chmod 644