Skip to content

Instantly share code, notes, and snippets.

View eingress's full-sized avatar
:octocat:

Eingress Ltd eingress

:octocat:
View GitHub Profile
#!/bin/sh
SERVICES=$(echo "$DEPENDENCIES" | tr "|" "\n")
resolve()
{
for SERVICE in $SERVICES; do
ip=$(nslookup "$SERVICE" | awk '/^Address: / { print $2 }')
@c0d3kid
c0d3kid / revprox.go
Last active January 16, 2024 16:05 — forked from JalfResi/revprox.go
Simple reverse proxy in Go (forked from original to use a struct instead of a closure with ssl)
package main
import (
"crypto/tls"
"log"
"net/http"
"net/http/httputil"
"net/url"
)
@stonking
stonking / cf-worker-email.md
Created May 13, 2022 19:31
Send email from Cloudflare Workers via MailChannels

Send email from Cloudflare Workers via MailChannels

Cloudflare announced a partnership with MailChannels that allows you to send free email via workers.

The example code that MailChannels supplied wasn't working so I fixed it here to make testing easy.

  1. Add include:relay.mailchannels.net to your domain's SPF record.
  2. Update the code below with your email addresses
  3. Create worker, paste code, save and deploy and test
@osaxma
osaxma / hasura_connect_ex.dart
Last active March 4, 2024 09:38
a workaround for keeping haura_connect subscriptions alive when using JWT
import 'dart:async';
import 'package:meta/meta.dart';
import 'package:hasura_connect/hasura_connect.dart';
import 'package:http/http.dart' as http;
// problem:
// when subscribing to`HasuraConnect.subscription`, a websocket connection is created on the first subscription
// call. The websocket connection is created only once with the initial subscription and the provided TokenInterceptor
// or headers. When the token expires during an active subscription, HasuraConnect doesn't stop the subscription, or try
// to reconnect with the latest token in in the TokenInterceptor nor does it throw an error. It'll keep calling `onRequest`
@oofnikj
oofnikj / answerfile
Last active July 29, 2024 13:55
Install Docker on Termux
KEYMAPOPTS="us us"
HOSTNAMEOPTS="-n alpine"
INTERFACESOPTS="auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
hostname alpine
"
TIMEZONEOPTS="-z UTC"
@jesugmz
jesugmz / Deploy-Next.js-static-to-GitLab-pages.md
Last active April 9, 2024 14:33
Deploy Next.js static to GitLab pages

Deploy Next.js static to GitLab pages

Create a basic GitLab CI config:

$ cat .gitlab-ci.yml
image: node

before_script:
 - npm install
@tokdaniel
tokdaniel / hooks.ts
Last active November 19, 2019 00:02
import { useState, useEffect, useRef, EffectCallback } from 'react';
import throttle from 'lodash/throttle';
import debounce from 'lodash/debounce';
// Ties two states together, and tracks only if a specific case occur.
export const transitionTracker = <A, B>(from: A, to: B) => {
let marker = 0;
return (state1: A, state2: B) => {
if (from === state1 && to === state2) {
version: '3.1'
services:
reverse-proxy:
image: traefik # The official Traefik docker image
command: --api --docker # Enables the web UI and tells Traefik to listen to docker
ports:
- "80:80" # The HTTP port
- "8080:8080" # The Web UI (enabled by --api)
volumes:
- /var/run/docker.sock:/var/run/docker.sock # So that Traefik can listen to the Docker events
@AndersonIncorp
AndersonIncorp / install.md
Created June 29, 2018 16:36
Install any linux distro on VPS with low RAM, locked ISO boot

Overview

Scenario

  • Your VPS provider doesn't support ISO mount
  • Your VPS has low RAM and cannot load whole ISO image
  • Your current /boot is to small to contain ISO file

Workaround

  • Boot low memory ISO (CorePure64.iso ~ 14MB)
  • Create new partition ~1GB / size of your ISO
  • dd your ISO into that partition
@claus
claus / ipfs-server-setup.md
Last active May 9, 2023 03:51
Host Your Site Under Your Domain on IPFS

Host Your Site Under Your Domain on IPFS

This is a step-by-step tutorial for hosting your website under your domain on IPFS, from zero, on a DigitalOcean Ubuntu 16.04.3 x64 Droplet (i am using the $10 variant with 2GB RAM).

Install IPFS

Log in as root.

First, make sure the system is up to date, and install tar and wget: