Skip to content

Instantly share code, notes, and snippets.

View benbonnet's full-sized avatar

Ben benbonnet

View GitHub Profile
const controllers = import.meta.glob('../../components/**/index.(js|jsx)', {
eager: true
});
Object.keys(controllers).forEach(path => {
const mod = controllers[path].default;
if (mod) {
const splittedPath = path.split('/');
const identifier = splittedPath[splittedPath.length - 2];
app.register(identifier, controllers[path].default);
### Keybase proof
I hereby claim:
* I am benbonnet on github.
* I am deemx (https://keybase.io/deemx) on keybase.
* I have a public key ASB17ro6GMH93r9zzIH9RYSsdZLgb0UplwE2VT2z334Iywo
To claim this, I am signing this object:
ACTIONS = %i[index get create update]
class BaseClass; end
class ObjectEngine
attr_reader :item, :schema
def initialize(item)
@item = item
# @schema = item.application.schema
end
function createPgInstance() {
export BASE_PATH=$HOME/postgres-storage;
export INSTANCES_COUNT=$(find $BASE_PATH -maxdepth 1 -type d | wc -w);
export PORT=$1
export PG_USERNAME=$2
export PG_PASSWORD=$3
export DBNAME=postgres$PORT
export INSTALLFOLDER=$BASE_PATH/$DBNAME/data;
export LOG_FOLDER=$BASE_PATH/$DBNAME/$DBNAME.log;
export SYSTEMDFILE=/etc/systemd/system/$DBNAME.service;
function createRedisInstance() {
export BASE_PATH=$HOME/redis-storage;
export INSTANCES_COUNT=$(sudo find $BASE_PATH -maxdepth 1 -type d | wc -w);
export PORT=$1
export REDIS_PASSWORD=$2
export DBNAME=redis$PORT;
export INSTALLFOLDER=$BASE_PATH/$DBNAME;
export CONFIGFILE=$INSTALLFOLDER/redis.conf;
export SYSTEMDFILE=/etc/systemd/system/$DBNAME.service;
export PIDFILE=$INSTALLFOLDER/redis.pid;
@benbonnet
benbonnet / gcrgc.sh
Created July 21, 2019 02:07 — forked from ahmetb/gcrgc.sh
Script to clean up Google Container Registry images pushed before a particular date
#!/bin/bash
# Copyright © 2017 Google Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
@benbonnet
benbonnet / gist:87ead45d11f2ba9c076531391930cc41
Last active May 20, 2019 10:04
Ubuntu18 / Ruby 2.6.1 / Nginx Lua Auto SSL
upstream railsapp {
server unix:///path/to/app/shared/tmp/sockets/puma.sock;
}
location / {
proxy_pass http://railsapp;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
@benbonnet
benbonnet / app-graphql-ruby.rb
Last active April 19, 2019 12:08
Basic graphql ruby implementation, using Query, Input, Resolvers, Types and Mutations
require 'graphql'
require 'awesome_print'
#########
# TYPES #
#########
module Types
class BaseObject < GraphQL::Schema::Object
end
export DOMAIN=docker-metal.ngx.host
export APP_ADDRESS=localhost:8080
docker run -d \
--name nginx-auto-ssl \
--restart on-failure \
--network host \
-e ALLOWED_DOMAINS="$DOMAIN" \
-e SITES="$DOMAIN=$APP_ADDRESS" \
-v ssl-data:/etc/resty-auto-ssl \
@benbonnet
benbonnet / kubernetes.sh
Last active March 19, 2019 00:38
kubernetes on Ubuntu 18.10
# Source : https://mherman.org/blog/setting-up-a-kubernetes-cluster-on-ubuntu/
# on all nodes
sudo apt-get update && sudo apt-get install -y apt-transport-https
curl -s https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
sudo apt update && sudo apt install -qy docker-ce
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" > /etc/apt/sources.list.d/kubernetes.list
sudo apt-get update && sudo apt-get install -y kubeadm kubelet kubectl