Skip to content

Instantly share code, notes, and snippets.

View felegy's full-sized avatar
🎯
Focusing

Gabor FELEGYHAZI felegy

🎯
Focusing
View GitHub Profile
@felegy
felegy / rancher-over-cloudflare-tunnel.md
Last active June 20, 2023 10:40
Proxying Rancher UI over Cloudflare via CF tunnel with Rancher`s built-in Kubernetes api proxy
#!/usr/bin/env bash
SWAP_SIZE=${SWAP_SIZE-"4G"}
SWAP_FILE=${SWAP_FILE-"/swap"}
fallocate -l "$SWAP_SIZE" "$SWAP_FILE"
chmod 600 "$SWAP_FILE"
mkswap "$SWAP_FILE"
swapon "$SWAP_FILE"
echo "$SWAP_FILE swap swap defaults 0 0" >>/etc/fstab
swapon --show
@felegy
felegy / error.html
Last active November 8, 2021 15:18
Nginx custom error page
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Your Business</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<!--# if expr="$status = 502" -->
<meta http-equiv="refresh" content="2">
<!--# endif -->
</head>
@felegy
felegy / http-get.sh
Last active September 22, 2022 13:25
Poor man's `CURL` or `WGET`
#!/usr/bin/env sh
#
# Usage: http-get.sh [PATH PORT HOST]
#
# Environment variables
# REQUEST_PATH - path of the request, default value `/`
# REQUEST_PORT - http port, default value `80`
# REQUEST_HOST - host of the request, default value `localhost`
REQUEST_PATH=${1:-${REQUEST_PATH-/}}

Cake Build FakeProcessRunner

The main purpose of this to dump the process command and arguments in string format for later execution or use it (for example use to run inside Docker). I would like to run the system related tests in a build process based on cake generated test commands in separated environments (like Docker swarm service in compose/swarm stack).

Cake dotnet Test command:

DotNetCoreTest(SolutionFile, new DotNetCoreTestSettings
{
    Configuration = configuration,
# use docker_provider: "ee", "ce", "master" or ""
$docker_provider = "master"
$docker_version = "19.03.8"
if (Test-Path env:docker_provider) {
$docker_provider = $env:docker_provider
}
if (Test-Path env:docker_version) {
$docker_version = $env:docker_version
}
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDynuma5eJ1JvkpyAUUt8uQI+IvMBJ3fKBo9SJQr3Po/ho1aLFSEv5tUC20j2UAjNVmB2iFV1VVIOC0uigMDtV1T5PvLKjjjXHGYmicH/vfuiuf7dFYmMYPD225dNfnpYHisjxuItAezd8Rdbtsi4TP0HldNQJuAlla1hl5WACN2IBngnwmSatNa116yAbsgzK7MLsXY2w7rgiSyBqtrktiW5wrP00an2ImUDMBIsh7HyaGFLi/eOzEZu8GUd4yaBvGqn5qpOs5VSX+U/qSTfD+nyNEYKN5BIEH+ctBaNQP3vwHvf73CuNuIqmV88dJ/Gun1o+GlxtaL+/BmY8haz4n6AGr9pO1KVgDH5YNUcybpAsH+DzDvSc//wU/3f1qhsbezLw6oFCqcL8xmRu2eiFRHh/3UqDb3jrhYiQ5r6/3+Yv78S8PgU0fwBCK1t0sU9IfsLmLt6Jrmknxxg8UD6GjNc+KG6EvfMOqB2YKR2dI/k44OKNwwEcS6M1rulQS2U9eaAs97GyhU2umNG2RvF+eiCUwI/Uisz9F0yEoU2veop6JAFTd4GSNM758m0OswEhW8++/TFpuA5WEnvi+5ccuhJT6rKJuS194p4DpB3QzKOLxzWNQVRpcXSc7lO5RjtELj5mPP4zc5D6x5jtntNNyd5wjYxCg2D3uCOMPSb/+Yw== cardno:000612033806
@felegy
felegy / .1_lando-heroku-php.md
Last active November 4, 2019 17:17
Lando Heroku PHP scaffold

Lando Heroku PHP

Lando Heroku PHP scaffold

  • Heroku identical devenv (as far as possible)
    • heroku-18 official docker image
    • heroku official PHP buildpack
  • Integrated tooling
    • Composer on appserver
using System;
using System.Collections.Generic;
using System.Linq;
using Xunit;
public class SidPocTest
{
private const int DefaultSize = 8;
private const string DefaultAlphabet = "123456789abcdefghijkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ";
public class MicrosecondEpochConverter : Newtonsoft.Json.Converters.DateTimeConverterBase
{
private static readonly System.DateTime _epoch = new System.DateTime(1970, 1, 1, 0, 0, 0, System.DateTimeKind.Utc);
public override void WriteJson(Newtonsoft.Json.JsonWriter writer, object value, Newtonsoft.Json.JsonSerializer serializer)
{
writer.WriteRawValue(((System.DateTime)value - _epoch).TotalMilliseconds + "000");
}
public override object ReadJson(Newtonsoft.Json.JsonReader reader, System.Type objectType, object existingValue, Newtonsoft.Json.JsonSerializer serializer)