Skip to content

Instantly share code, notes, and snippets.

View butsjoh's full-sized avatar

Buts Johan butsjoh

  • Younited
  • Belgium
View GitHub Profile
@rmosolgo
rmosolgo / introspection_hiding.rb
Created July 13, 2023 15:29
Hiding introspection fields with GraphQL-Ruby
require "bundler/inline"
gemfile do
gem "graphql", "2.0.24"
end
class MySchema < GraphQL::Schema
module CustomIntrospection
module HideIntrospectionByContext
def visible?(ctx)
@goldeneggg
goldeneggg / ci.yml
Last active September 4, 2023 19:49
Rails 6 API Development and GitHub Actions CI with Docker (.github/workflows/ci.yml)
on:
push:
branches:
- master
paths-ignore:
- '**/*.md'
- 'LICENSE'
pull_request:
paths-ignore:
- '**/*.md'
@ewen-lbh
ewen-lbh / remove_deployments_tab.py
Last active September 14, 2023 01:48
Remove the "Deployments" tab from github.com
"""
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
@Rhoxio
Rhoxio / Rakefile
Last active December 3, 2023 04:17
Rakefile for rails-like functionality with ActiveRecord 6
require "active_record"
namespace :db do
db_config = YAML::load(File.open('config/database.yml'))
db_config_admin = db_config.merge({'database' => 'postgres', 'schema_search_path' => 'public'})
desc "Create the database"
task :create do
ActiveRecord::Base.establish_connection(db_config_admin)
@gido
gido / docker-compose.example1.yml
Last active September 28, 2022 13:01
Example to keep your bash history with docker compose
version: '3.6'
services:
dev:
image: ubuntu
volumes:
# '~/.docker_bash_history' file should exist before mounting
- $HOME/.docker_bash_history:/root/.bash_history
# ...
@dsalahutdinov
dsalahutdinov / Dockerfile.dev
Last active May 25, 2021 21:02
Dockerize Ruby backend of the multi-service application for local development
FROM ruby:2.6.1
ARG PG_VERSION
ARG NODE_VERSION
ARG TINI_VERSION=v0.18.0
RUN curl -sSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \
&& echo 'deb http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main' $PG_VERSION > /etc/apt/sources.list.d/pgdg.list \
&& curl -o /tmp/nodejs.deb https://deb.nodesource.com/node_11.x/pool/main/n/nodejs/nodejs_$NODE_VERSION-1nodesource1_amd64.deb \
&& apt-get update -qq \
require 'cgi'
require 'active_support'
def verify_and_decrypt_session_cookie(cookie, secret_key_base = Rails.application.secret_key_base)
config = Rails.application.config
cookie = CGI::unescape(cookie)
salt = config.action_dispatch.authenticated_encrypted_cookie_salt
encrypted_cookie_cipher = config.action_dispatch.encrypted_cookie_cipher || 'aes-256-gcm'
# serializer = ActiveSupport::MessageEncryptor::NullSerializer # use this line if you don't know your serializer
serializer = ActionDispatch::Cookies::JsonSerializer
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { accessor } from 'react-big-calendar/lib/utils/accessors';
import { accessor as accessorPropType } from 'react-big-calendar/lib/utils/propTypes';
import { noop } from 'lodash';
import { zonedToLocal, localToZoned } from '/client/utils/timezones';
import { hasTime, shiftDate, shiftHour } from '/client/utils/date';
/**
* withTimeZone - HOC to add time zone support to react-big-calendar
@izznogooood
izznogooood / systemd_docker.md
Last active April 9, 2022 16:32
How to use systemd as a docker manager. Nextcloud example with backup.

I have always found systemd to be a reliable manager for my docker containers, here is a few examples that should be enough to get the general idea.

I thought a symbiotic example would be best as that's about as complicated as it gets.

Some basic systemd usage skills like how to use systemctl and deamon-reload are expeted. (Remember NOT! to deamonize the containers! -d --deamonize in the docker command.)

MariaDB

@andywirv
andywirv / output.tf
Created November 3, 2017 16:16
Multi-line Output for Terraform
output "SSH Config" {
value = <<SSHCONFIG
### START Auto-gen SSH Config for ${random_pet.cluster_id.id} ###
Host ${random_pet.cluster_id.id}-bastion
User core
Hostname ${aws_instance.bastion.public_ip}
IdentityFile ~/.ssh/${random_pet.cluster_id.id}.key
Host ${random_pet.cluster_id.id}-agent