Skip to content

Instantly share code, notes, and snippets.

View kevinsimper's full-sized avatar

Kevin Simper kevinsimper

View GitHub Profile
@kevinsimper
kevinsimper / humanize-bytes.sh
Created August 9, 2023 13:10
Humanize bytes on Mac
# First install GNU CoreUtils
$ brew install coreutils
# pass bytes to numfmt
$ numfmt --to=iec-i --suffix=B --format="%9.2f" 3168122
3.03MiB
@kevinsimper
kevinsimper / query.sql
Created June 30, 2023 09:15
Normalized URL in bigquery for Next.js routes
SELECT
normalizedUrl,
COUNT(1)
FROM (
SELECT
httpRequest.requestUrl,
REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(httpRequest.requestUrl, r'/_next/data/[^/]+', ''), r'\d+', '[id]'), r'\.json', '') AS normalizedUrl
FROM
`greenmobility.cloudrun_requests.run_googleapis_com_requests`
WHERE
@kevinsimper
kevinsimper / marker.js
Created June 19, 2020 23:22
Google Maps marker with SVG
const color = car.isReserved ? "#ff9900" : "#" + car.vehicleState.color;
const icon = {
path:
"m30,65c-8,-11 -17,-27 -18,-34c-1,-5 2,-13 7,-19c11,-13 34,-10 41,5c4,9 4,13 1,23c-3,8 -18,31 -22,33c-1,0 -5,-3 -9,-8z",
fillColor: color,
fillOpacity: 0.9,
scale: 0.7,
strokeColor: "#fff",
strokeWeight: 3,
anchor: new google.maps.Point(40, 74),
commit 4efbae971b6d4f5aeeb876307657c86545f8948b
Author: Kevin Simper <kevin.simper@gmail.com>
Date: Thu Mar 26 17:26:43 2020 +0100
Article spelled client_id wrong
diff --git a/server.js b/server.js
index c3b2928..b7980ac 100644
--- a/server.js
+++ b/server.js
@kevinsimper
kevinsimper / chrome_powershell.txt
Created May 21, 2019 04:26
Install Chrome via Powershell
$Path = $env:TEMP; $Installer = "chrome_installer.exe"; Invoke-WebRequest "http://dl.google.com/chrome/install/375.126/chrome_installer.exe" -OutFile $Path\$Installer; Start-Process -FilePath $Path\$Installer -Args "/silent /install" -Verb RunAs -Wait; Remove-Item $Path\$Installer

Keybase proof

I hereby claim:

  • I am kevinsimper on github.
  • I am kevinsimper (https://keybase.io/kevinsimper) on keybase.
  • I have a public key ASCG1XWtsxqP-WApckSPN264AVczgbnEqAdbRkwzzp-4IAo

To claim this, I am signing this object:

apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
labels:
app: nginx
spec:
replicas: 3
selector:
matchLabels:
type http;
[@bs.deriving abstract]
type req = {url: string};
type res;
[@bs.send] external _end : (res, string) => unit = "end";
type handler = (req, res) => unit;
type server;
[@bs.send] external listen : (server, int) => unit = "";
[@bs.send] external createServer : (http, handler) => server = "";
[@bs.module] external http : http = "";
[
{
"id": 114255956,
"name": "react-i18n",
"full_name": "connectedcars/react-i18n",
"owner": {
"login": "connectedcars",
"id": 23233019,
"avatar_url": "https://avatars1.githubusercontent.com/u/23233019?v=4",
"gravatar_id": "",
kubectl get — no-headers secret | awk '{print $1}' | \
xargs -I{} sh -c 'kubectl get secret -o yaml "$1" > "$1.yaml"' — {}