Skip to content

Instantly share code, notes, and snippets.

@gonzaloplaza
gonzaloplaza / aws_ec2_ubuntu_userdata_docker.sh
Last active April 16, 2024 09:57
Script to auto install Docker (last version) into AWS EC2/Ubuntu instance at launch time: User Data
#!/bin/bash
# Install docker
apt-get update
apt-get install -y cloud-utils apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
apt-get update
@leodutra
leodutra / headset-setup-bt.sh
Last active April 16, 2024 09:57
Bluetooth headset/ headphone Ubuntu 20.04 - tested with Sony WH-1000XM4 - shell script
#!/bin/sh
# sudo add-apt-repository ppa:eh5/pulseaudio-a2dp (NOT NEEDED ANYMORE)
sudo apt update
sudo apt install libldac \
libavcodec-extra58 \
pulseaudio \
pulseaudio-module-bluetooth \
blueman
@gigaherz
gigaherz / 00 Explanation.md
Last active April 16, 2024 09:52
Custom shader rendertype mini-howto example (forge 37.0.15+)

Making a custom render type with a custom shader requires a number of things to exist at once:

  1. A ShaderInstance which references your shader json. The RegisterShadersEvent lets you define a ShaderInstance, and has a callback for when the shader is fully loaded from disk.
  2. A ShaderStateShard with a supplier that returns the ShaderInstance. The supplier exists so that shaders can reload themselves when you change resourcepacks or do a F3+T reload.
  3. A RenderType which uses the ShaderStateShard as its shader state.
  4. A shader json, which declares the shader properties and points to the shader programs (vsh and fsh).
  5. A vertex shader program, which describes how the vertex data is transformed before passing into the rasterizer and being turned into pixels.
  6. A fragment shader program, which describes how the interpolated values from the vertices get turned into color values before being passed into the output blending stage.

Note: The vanilla logic does not normally allow namespaces in the shader

@irbull
irbull / OpenSSLExample.cpp
Created August 11, 2016 18:32
Code signing and verification with OpenSSL
#include <iostream>
#include <openssl/aes.h>
#include <openssl/evp.h>
#include <openssl/rsa.h>
#include <openssl/pem.h>
#include <openssl/ssl.h>
#include <openssl/bio.h>
#include <openssl/err.h>
#include <assert.h>
@rwaldron
rwaldron / branch-count.sh
Created June 15, 2011 16:08
Count number of branches in a repo
git branch | wc -l
@opyate
opyate / README.md
Last active April 16, 2024 09:50
Simple no-cache gamedev-friendly Python 3 webserver for testing web builds locally

Seeing this when running an HTML5 Godot game?

image

This is a simple no-cache Python 3 gamedev-friendly webserver which runs on port 4443.

Run with

python3 gamedevweb.py
@neoakris
neoakris / 0_traefik_mirror_lab.md
Last active April 16, 2024 09:48
Reproducible Demo of Traefik 2.0 Traffic Mirroring on EKS

Reproducible Demo of Traefik 2.0 Traffic Mirroring

Overview

What to expect in this doc:

  • Traefik 2.0 has traffic mirroring functionality that should work on generic Kubernetes, but there's no good how-to guides, let this be the first.
  • This is a how-to guide, that's optimized for understanding
@chitchcock
chitchcock / 20111011_SteveYeggeGooglePlatformRant.md
Created October 12, 2011 15:53
Stevey's Google Platforms Rant

Stevey's Google Platforms Rant

I was at Amazon for about six and a half years, and now I've been at Google for that long. One thing that struck me immediately about the two companies -- an impression that has been reinforced almost daily -- is that Amazon does everything wrong, and Google does everything right. Sure, it's a sweeping generalization, but a surprisingly accurate one. It's pretty crazy. There are probably a hundred or even two hundred different ways you can compare the two companies, and Google is superior in all but three of them, if I recall correctly. I actually did a spreadsheet at one point but Legal wouldn't let me show it to anyone, even though recruiting loved it.

I mean, just to give you a very brief taste: Amazon's recruiting process is fundamentally flawed by having teams hire for themselves, so their hiring bar is incredibly inconsistent across teams, despite various efforts they've made to level it out. And their operations are a mess; they don't real

@hideokamoto
hideokamoto / hono.ts
Last active April 16, 2024 09:47
Cloudflare Workers (with Hono)で、WordPressの記事情報を使ったRAGを作るサンプル
import { Hono } from 'hono'
import { CloudflareVectorizeStore } from "langchain/vectorstores/cloudflare_vectorize";
import { OpenAIEmbeddings } from "langchain/embeddings/openai";
import { ChatOpenAI } from "langchain/chat_models/openai";
import { Document } from 'langchain/document';
import {
RunnablePassthrough,
RunnableSequence,
} from "langchain/schema/runnable";
import { StringOutputParser } from "langchain/schema/output_parser";
@heitorlessa
heitorlessa / app.py
Created April 15, 2024 18:17
Discord Powertools for AWS Lambda - Parsing EventBridge ECS Task State Change event
from __future__ import annotations
from typing import List
from aws_lambda_powertools.utilities.parser.models import EventBridgeModel
from aws_lambda_powertools.utilities.parser.envelopes import (
EventBridgeEnvelope, # only if you want to discard EventBridge metadata
)
from aws_lambda_powertools.utilities.parser.parser import event_parser
from pydantic import BaseModel