Skip to content

Instantly share code, notes, and snippets.

View linkdd's full-sized avatar
🙂

David Delassus linkdd

🙂
View GitHub Profile
@linkdd
linkdd / hackernews-new-comms.js
Last active August 25, 2024 11:15
Add a bell emoji to unread comments on HackerNews
// Can be used with https://github.com/xcv58/Custom-JavaScript-for-Websites-2
// This snippet is released under the terms of the CC0 license: https://creativecommons.org/publicdomain/zero/1.0/deed.en
const cache_key = 'hn_comments_views'
const cache = JSON.parse(localStorage.getItem(cache_key) || '{}')
document.querySelectorAll('.athing.comtr').forEach(comm => {
if (!cache[comm.id]) {
const span = document.createElement('span')
span.innerHTML = '🔔' // :bell: emoji
@linkdd
linkdd / config.exs
Created September 14, 2021 22:39
Example of datapio_cluster_config
import Config
config :datapio_cluster,
service_name: [env: "MYAPP_SERVICE_NAME", default: nil],
app_name: [env: "MYAPP_APP_NAME", default: "my_app"],
cache_tables: [
some_set: [:id, :attr1, :attr2],
some_other_set: [:id, :attr]
]
@linkdd
linkdd / mix.exs
Created September 14, 2021 22:30
Sample Mix project configuration with datapio_cluster
defmodule MyApp.MixProject do
use Mix.Project
def project do
[
app: :my_app,
version: "0.1.0",
elixir: "~> 1.12",
start_permanent: Mix.env() == :prod,
deps: deps()
@linkdd
linkdd / example-libcluster.ex
Last active September 16, 2021 10:30
Example of libcluster configuration (Elixir)
defmodule MyApp.Application do
use Application
def start(_type, _args) do
topologies = [
default: [
strategy: Cluster.Strategy.Kubernetes.DNS,
config: [
service: "my-elixir-app-svc-headless",
application_name: "my_app"
@linkdd
linkdd / service-headless.yaml
Created September 14, 2021 17:28
Example of headless Service for libcluster (Elixir)
---
apiVersion: v1
kind: Service
metadata:
name: my-elixir-app-svc-headless
namespace: default
labels:
app.kubernetes.io/name: my-elixir-app
app.kubernetes.io/instance: myapp-svc-headless
spec:
@linkdd
linkdd / deployment.yaml
Created September 14, 2021 17:09
Example of Elixir deployment for Kubernetes
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-elixir-app
namespace: default
labels:
app.kubernetes.io/name: my-elixir-app
app.kubernetes.io/instance: myapp-cluster
spec:
@linkdd
linkdd / elixir-node.dockerfile
Last active April 25, 2022 21:05
Example of Dockerfile for an Elixir application
FROM elixir:1.12-alpine AS builder
ARG BUILD_ENV=prod
ARG BUILD_REL=my_app
# Install system dependencies
RUN mix local.hex --force
RUN mix local.rebar --force
# Add sources
@linkdd
linkdd / config.toml
Last active March 17, 2021 13:32
Standard Web Components with Hugo
baseURL = "https://example.com"
languageCode = "en-us"
title = "Example of Standard Web Component"
{match,[
{variable_name,"Mega"},
{assign_operator,"="},
{identifier,"graph"},
{left_parenthesis,"("},
{identifier,"id"},
{assign_operator,"="},
{left_bracket,"["},
{variable_name,"Help"},
{list_separator,","},
@linkdd
linkdd / setup.py
Last active February 18, 2016 13:25
setup.py skeleton
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
import sys
import os
NAME = '<package name>'
KEYWORDS = '<keyword 1> <keyword 2>'
DESC = '<package description>'