Skip to content

Instantly share code, notes, and snippets.

View jhult's full-sized avatar

Jonathan Hult jhult

View GitHub Profile
@schacon
schacon / better-git-branch.sh
Created January 13, 2024 18:41
Better Git Branch output
#!/bin/bash
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
NO_COLOR='\033[0m'
BLUE='\033[0;34m'
YELLOW='\033[0;33m'
NO_COLOR='\033[0m'
@rossedman
rossedman / main.tf
Last active March 7, 2024 14:00
Scale homelab into cloud with Tailscale, Terraform and cloud-init
terraform {
required_providers {
digitalocean = {
source = "digitalocean/digitalocean"
}
}
}
provider "digitalocean" {
}
@tykurtz
tykurtz / grokking_to_leetcode.md
Last active May 7, 2024 16:07
Grokking the coding interview equivalent leetcode problems

GROKKING NOTES

I liked the way Grokking the coding interview organized problems into learnable patterns. However, the course is expensive and the majority of the time the problems are copy-pasted from leetcode. As the explanations on leetcode are usually just as good, the course really boils down to being a glorified curated list of leetcode problems.

So below I made a list of leetcode problems that are as close to grokking problems as possible.

Pattern: Sliding Window

@pirate
pirate / docker-compose.yml
Last active January 14, 2022 19:34
Example networking sidecar ingress containers for Cloudflare Argo, Wireguard, Tailscale, LetSencrypt, Caddy, and SOCKS/SSH tunnel containers in Docker Compose.
# Example networking sidecar ingress containers for Cloudflare Argo, Wireguard, Tailscale, LetSencrypt, Caddy, and SOCKS/SSH tunnel containers in Docker Compose.
# https://gist.github.com/pirate/1996d3ed6c5872b1b7afded250772f7c
# Goes well with these docker-compose database container examples:
# https://gist.github.com/pirate/1fafaa18a47254f388aa5c0f79f7d263
version: '2.4'
services:
demo:
@berkant
berkant / cloud-init.cfg
Last active April 26, 2024 17:58
Cloud-init config to set up my Ubuntu dev machine.
## template: jinja
#cloud-config
{% if v1.distro_release == 'focal' %}
users:
- name: berkant
shell: /usr/bin/bash
ssh_import_id: gh:berkant
sudo: ALL=(ALL:ALL) NOPASSWD:ALL
@nicowilliams
nicowilliams / bisect-rebase.sh
Last active April 28, 2024 01:46
Bisection, but for git rebase, to quickly rebase across thousands of upstream commits
# Viktor Dukhovni's (@vdukhovni) slow rebase, made faster by bisecting, sort of
#
# fastrebase BRANCH_TO_REBASE ONTO
function fastrebase {
typeset b N
if (($# > 0)) && [[ $1 = -h || $1 = --help ]]; then
printf 'Usage: fastrebase BRANCH_TO_REBASE ONTO_HEAD\n'
printf ' fastrebase # to continue after resolving conflicts\n'
printf '\n\tfastrebase is a shell function that uses the following\n'
@danilobatistaqueiroz
danilobatistaqueiroz / amqp_vs_jms.md
Last active November 8, 2023 09:53
Redis vs AMQP vs JMS vs Kafka

AMQP vs JMS

JMS: only java, it is a specification
AMPQ: universal, it is a protocol, it is open standard for messaging

JMS doesn't define a protocol.

JMS is an API and AMQP is a protocol.

AMQP supports 4 message models: Direct, Fanout, Topic, Headers

import os
from datetime import datetime, timedelta
from typing import Any, Dict, Generator, List, Union
import requests
# Optional - to connect using OAuth credentials
from oauthlib.oauth1 import SIGNATURE_RSA
class JiraClient:
def __init__(
@tanaikech
tanaikech / submit.md
Last active April 16, 2024 14:46
Modifying Revisions of a File on Google Drive using Google Apps Script

Modifying Revisions of a File on Google Drive using Google Apps Script

This is a sample script for modifying the revisions of a file on Google Drive using Google Apps Script. This script can be used for not only Google Docs files, but also the files except for Google Docs.

Issue and workaround:

Unfortunately, in the current stage, at Google Docs files, the revision of Google Docs cannot be directly changed by APIs with a script. So as one of several workarounds, I would like to propose to overwrite the Google Docs file using the exported data. On the other hand, at the files except for Google Docs, the data can be directly retrieved with the revision ID. This can be used for overwriting the file. The flow of this script is as follows.

For Google Docs files: