Skip to content

Instantly share code, notes, and snippets.

@joshlong
joshlong / Main.java
Last active April 17, 2025 04:54
a simple Java 23 program demonstrating some of the things showing how nice modern Java can be, based on the C# equivalent shown in https://youtu.be/1I3mWSiWNsI?feature=shared&t=374
// sdk install java 23.0.1-librca && sdk use java 23.0.1-librca
// java --enable-preview Main.java
record Point(int x, int y) {}
sealed interface Shape permits Rectangle, Circle {}
record Rectangle(int width, int height) implements Shape {}
record Circle(int radius) implements Shape {}
void main() {
var point = new Point(1, 2);
println(describePoint(point));
@kconner
kconner / macOS Internals.md
Last active April 24, 2025 10:08
macOS Internals

macOS Internals

Understand your Mac and iPhone more deeply by tracing the evolution of Mac OS X from prelease to Swift. John Siracusa delivers the details.

Starting Points

How to use this gist

You've got two main options:

@saiyam1814
saiyam1814 / kubernetes-containerd.sh
Created July 25, 2022 08:42
kubernetes-containerd.sh
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
echo "step1"
echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
echo "kubeadm install"
sudo apt update -y
sudo apt -y install vim git curl wget kubelet=1.24.3-00 kubeadm=1.24.3-00 kubectl=1.24.3-00
echo "memory swapoff"
sudo sed -i '/ swap / s/^\(.*\)$/#\1/g' /etc/fstab
sudo swapoff -a
sudo modprobe overlay
@leandronsp
leandronsp / add-index.sql
Created June 11, 2022 02:54
Comparing B-Tree index vs CTE's
DROP INDEX IF EXISTS transfers_in, transfers_out;
CREATE INDEX transfers_in ON transfers (target_account_id);
CREATE INDEX transfers_out ON transfers (source_account_id);
@maxandersen
maxandersen / Dockerfile
Last active April 27, 2022 11:06
This is a standalone dockerfile with embedded java and using jbang for building as answer to https://twitter.com/jordisola_/status/1517244462673674240?s=20 Try out using: `docker build -t myapp . && docker run -p 8080:8080 myapp`
# syntax=docker/dockerfile:1.4
FROM jbangdev/jbang-action as builder
WORKDIR /
COPY <<EOF main.java
//DEPS io.quarkus:quarkus-bom:2.8.0.Final@pom
//DEPS io.quarkus:quarkus-resteasy-reactive
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
@scyto
scyto / docker-swarm-architecture.md
Last active April 25, 2025 21:04
My Docker Swarm Architecture

This (and related gists) captures how i created my docker swarm architecture. This is intended mostly for my own notes incase i need to re-creeate anything later! As such expect some typos and possibly even an error...

Installation Step-by-Step

Each major task has its own gist, this is to help with maitainability long term.

  1. Install Debian VM for each docker host
  2. install Docker
  3. Configure Docker Swarm
  4. Install Portainer
  5. Install KeepaliveD
  6. Using VirtioFS backed by CephFS for bind mounts (migrating from glsuterFS - WIP)
/*
If last close exists: open = last_close, else open = first(price)
*/
SELECT
time_bucket('1 day', time) AS bucket,
symbol,
CASE
WHEN LAST(price_close, time) IS NOT NULL THEN LAST(price_close, time)
ELSE FIRST(price_open, time)
END AS price_open
@SwitHak
SwitHak / 20211210-TLP-WHITE_LOG4J.md
Last active February 7, 2025 23:49
BlueTeam CheatSheet * Log4Shell* | Last updated: 2021-12-20 2238 UTC

Security Advisories / Bulletins / vendors Responses linked to Log4Shell (CVE-2021-44228)

Errors, typos, something to say ?

  • If you want to add a link, comment or send it to me
  • Feel free to report any mistake directly below in the comment or in DM on Twitter @SwitHak

Other great resources

  • Royce Williams list sorted by vendors responses Royce List
  • Very detailed list NCSC-NL
  • The list maintained by U.S. Cybersecurity and Infrastructure Security Agency: CISA List
@troyhunt
troyhunt / nmerrigan.json
Created October 2, 2021 20:51
Scraped LinkedIn data of Niall Merrigan
{
"id":"PMTPbtB79fUTnDS2f2Hn7Q_0000",
"full_name":"niall merrigan",
"first_name":"niall",
"middle_initial":null,
"middle_name":null,
"last_name":"merrigan",
"gender":"male",
"birth_year":null,
"birth_date":null,