Skip to content

Instantly share code, notes, and snippets.

View aslafy-z's full-sized avatar

Zadkiel AHARONIAN aslafy-z

View GitHub Profile
@ruphy
ruphy / GPT3.js
Last active November 2, 2023 23:41
GPT3() function for Google Sheets
// SPDX-License-Identifier: MIT
//
// This code will add a GPT3() function in your Google Sheets
// This code is originally inspired from https://twitter.com/fabianstelzer/status/1572926883179778050
// To use it, insert your API key below, open Google Sheets -> Extensions -> Apps Script -> Copy & Paste this -> Save
//
// Usage: =GPT3(prompt, max_tokens (default=15), model (default=davinci))
// Example usage: =GPT3("Once upon a time,", 1000, "davinci")
var API_KEY = "your-API-key";
@piratecarrot
piratecarrot / keepassxc-setup.sh
Last active October 2, 2023 10:45
Setting up KeePassXC with Google Drive synchronisation and SSH Agent
# This is intended to be copied and pasted to a console, not executed as a script... for now.
# Install some stuff, I use yay, you may use something else
sudo pacman -S keepassxc rclone curl
mkdir -p ~/.local/bin
mkdir -p ~/.local/lib/private
chmod 0700 ~/.local/lib/private
# CREATE YOUR KEEPASSXC BASE IN ~/.local/lib/private/
@teejaded
teejaded / kimgrpt.sh
Created April 21, 2021 20:18
kubectl cluster image report
# kimgrpt [NAMESPACE]
# Produces pod image report of all namespaces or just NAMESPACE if provided.
#
# jsonpath
# {\"\nNAMESPACE\tPODNAME\tIMAGES\n\"}
# {range .items[*]}
# {.metadata.namespace}{\"\t\"}
# {.metadata.name}{\"\t\"}
# {range .spec['containers','initContainers'][*]}
# {.image}{\"\t\"}
@wlib
wlib / LICENSE
Last active April 30, 2024 17:07
Run a shell script with bash, line-by-line, prompted on each command. Useful for running unknown scripts or debugging. Not a secure substitute for understanding a script beforehand.
MIT License
Copyright (c) 2021 Daniel Ethridge
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
#!/bin/bash
# sudo apt install jq wget curl
# usage: github-install user/repo
set -e
repo=$1
tmp="/tmp/.github-install"
binpath="$HOME/.local/bin"
rm -rf $tmp
@gasman
gasman / encode.py
Created October 25, 2020 12:23
Encoding a file as a Youtube video - https://www.youtube.com/watch?v=hyqLv2_zBdA
# Encode inputfile.tar.gz as a series of video frames
# Frames are written to frames/frameNNNN.png
from PIL import Image
with open('inputfile.tar.gz', 'rb') as f:
data = f.read()
WIDTH = 120
HEIGHT = 90
CHUNK_SIZE = int((WIDTH * HEIGHT) / 8)
@rawc0der
rawc0der / crd2jsonschema.sh
Last active April 18, 2024 14:43
Extract openapi JSON schema from Kubernetes CRD manifest
#!/bin/bash
# Small utility function based on yq to extract openAPIV3Schema from CRD
# example: crd2jsonschema.sh ./crd-alertmanager.yaml
set -e
function crd2jsonschema() {
set -e
local xkgroup="x-kubernetes-group-version-kind"
local document="$1"
local openAPIV3Schema=$(mktemp -u)
Rank Type Prefix/Suffix Length
1 Prefix my+ 2
2 Suffix +online 6
3 Prefix the+ 3
4 Suffix +web 3
5 Suffix +media 5
6 Prefix web+ 3
7 Suffix +world 5
8 Suffix +net 3
9 Prefix go+ 2
@shakna-israel
shakna-israel / LetsDestroyC.md
Created January 30, 2020 03:50
Let's Destroy C

Let's Destroy C

I have a pet project I work on, every now and then. CNoEvil.

The concept is simple enough.

What if, for a moment, we forgot all the rules we know. That we ignore every good idea, and accept all the terrible ones. That nothing is off limits. Can we turn C into a new language? Can we do what Lisp and Forth let the over-eager programmer do, but in C?


@reegnz
reegnz / README.md
Last active April 23, 2024 18:36
Implementing a jq REPL with fzf

Implementing a jq REPL with fzf

Update: I created jq-zsh-plugin that does this.

One of my favourite tools of my trade is jq. It essentially enables you to process json streams with the same power that sed, awk and grep provide you with for editing line-based formats (csv, tsv, etc.).

Another one of my favourite tools is fzf.