Skip to content

Instantly share code, notes, and snippets.

View veggiemonk's full-sized avatar

Julien Bisconti veggiemonk

View GitHub Profile
@veggiemonk
veggiemonk / jwt_function.sh
Created November 2, 2022 14:02
JWT with jq
# extract jwt token info
function jwtd () {
if [[ -x $(command -v jq) ]]; then
jq -R 'split(".") | .[0],.[1] | @base64d | fromjson' <<< "${1}"
echo "{\"Signature\": \"$(echo "${1}" | awk -F'.' '{print $3}')\"}"
fi
}
# Show the experiation date
# NOTE: on a mac, it needs coreutils for the date (use with `gdate`)

Capture a movie on your phone of the object by walking around it. If possible shoot it from different angles e.g. from above looking down, below looking up, side on etc. When you film it, walk around it or move the camera around it in a full 360 revolution (or even a couple of revolutions). You should get something like this (note that the image below is a resized copy of the orignal downrated to 1 fps):

DrinkingFountainSmall

Put the video into an empty folder and then use ffmpeg to extract the frames. You can experiment with different frame rates but generally there will be little value in extracting at 60fps or whatever your phone natively shoots at.

If you are on an iPhone you may need to convert your movie from .HEIC format first:

Archiving Websites

Every so often, you may find yourself needing to preserve a website in its current state. Whether this is in advance of a significant website change, general documentation, or the possibility that the site needs to be taken offline, it is a good idea to archive the site so that it is navigable locally and without the need for a server.

Introducing HTTrack HTTrack Website Copier will do just that, download a website to a local directory, build all the directories, get HTML, images, and other files from the server to your computer.

HTTrack has a GUI for Windows that works really well: http://www.httrack.com . You can also use this tool from the command line. See the following steps to archive websites using the HTTrack command line tools.

MacOS Installation: First, you will need to install HTTrack locally. On macOS, https://brew.sh/ is the package manager of choice (as opposed to MacPorts). Homebrew is simpler to set up but does require you

@veggiemonk
veggiemonk / hash_sha256.go
Created July 3, 2022 12:50
Go Snippets: hashing strings with SHA256 algorithm
package main
import (
"bytes"
"crypto/sha256"
"encoding/hex"
"fmt"
)
// Go Playground https://go.dev/play/p/1EaM_5NQmc5
@veggiemonk
veggiemonk / uuid_numbers.go
Created July 3, 2022 12:23
[experimental] Encode UUID as string of numbers
package main
import (
"fmt"
"math/big"
"strings"
"github.com/google/uuid"
)
@veggiemonk
veggiemonk / download-org-repos.sh
Last active November 16, 2021 13:23
download all repos from github org
curl \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/orgs/flyteorg/repos > repos.json
cat repos.json | jq '.[].git_url' | xargs -I REPO git clone REPO
format = """
$username\
$hostname\
$directory\
$git_branch\
$git_commit\
$git_state\
$git_status\
$docker_context\
$package\
@veggiemonk
veggiemonk / install_wireguard.sh
Created September 17, 2020 21:48
automated Install wireguard script for Ubuntu 20.04
@!/usr/bin/env bash
set -xe
sudo apt update && sudo apt install -y wireguard
export CLIENT_PUBLIC_KEY="[INSERT CLIENT PUB KEY HERE]"
export CLIENT_VPN_IP="10.0.0.2" # change this if necessary, the server vpn ip is 10.0.0.1 as defined in the config
export SERVER_NAME="serverwg"
@veggiemonk
veggiemonk / generate-kubeflow-manifest.sh
Created September 13, 2020 10:15
Generate KubeFlow manifest
#!/usr/bin/env bash
command -v kfctl >/dev/null 2>&1 || { echo; echo >&2"command kfctl is missing"; exit 1; }
command -v wget >/dev/null 2>&1 || { echo; echo >&2"command wget is missing"; exit 1; }
# Set the following kfctl configuration file:
# Other config can be found here: https://www.kubeflow.org/docs/started/getting-started/
export CONFIG_URI="https://raw.githubusercontent.com/kubeflow/manifests/v1.1-branch/kfdef/kfctl_k8s_istio.v1.1.0.yaml"
# Set KF_NAME to the name of your Kubeflow deployment. You also use this
# value as directory name when creating your configuration directory.
@veggiemonk
veggiemonk / .zshrc
Last active December 5, 2021 20:27
zshrc linux
export PATH=$HOME/bin:/usr/local/bin:$PATH
export ZSH="~/.oh-my-zsh"
ZSH_THEME="robbyrussell"
DISABLE_UPDATE_PROMPT="true"
# Uncomment the following line if pasting URLs and other text is messed up.
DISABLE_MAGIC_FUNCTIONS="true"