Skip to content

Instantly share code, notes, and snippets.

View khalilgharbaoui's full-sized avatar
🎯
Focusing

Khalil Gharbaoui khalilgharbaoui

🎯
Focusing
View GitHub Profile
#!/bin/bash
if [ "$1" = "-h" ] || [ -z "$1" ]; then
echo "Usage: pass miner's IP address to this script"
echo "or pass -h for this message :)"
exit 0
fi
if [ -z ${1+x} ]; then
MINER_IP_USE="$MINER_IP"
@loftwah
loftwah / docker-compose.yml
Created February 9, 2020 13:53 — forked from mTrax-/docker-compose.yml
Traefik v2 with ssl
version: "3.3"
services:
reverse-proxy:
image: traefik:latest
restart: unless-stopped
command:
- --api
- --providers.docker=true
- --entrypoints.web.address=:80
@undernewmanagement
undernewmanagement / docker-compose.yml
Created January 29, 2020 01:07
Pristine config for Traefik 2.0, Docker, and LetsEncrypt with sample container. Includes a HTTP to HTTPS redirect
version: '3'
services:
traefik:
container_name: traefik
image: traefik:v2.0
command:
- "--api.insecure=true"
- "--providers.docker=true"
@amkisko
amkisko / .github__gitlab__rails_postgresql_redis_rspec_codecov
Last active September 12, 2023 07:31
Rails, GitHub Actions, GitLab CI, PostgreSQL, Redis, rspec, codecov, Apollo GraphQL
Configuration files for Rails-driven project basic continuous integration using GitHub Actions and GitLab CI.
2020, amkisko (Andrei Makarov).
@mTrax-
mTrax- / docker-compose.yml
Created October 13, 2019 19:50
Traefik v2 with ssl
version: "3.3"
services:
reverse-proxy:
image: traefik:latest
restart: unless-stopped
command:
- --api
- --providers.docker=true
- --entrypoints.web.address=:80
@khalilgharbaoui
khalilgharbaoui / rails-jsonb-queries
Created October 7, 2019 00:30 — forked from mankind/rails-jsonb-queries
Rails-5 postgresql-9.6 jsonb queries
http://stackoverflow.com/questions/22667401/postgres-json-data-type-rails-query
http://stackoverflow.com/questions/40702813/query-on-postgres-json-array-field-in-rails
#payload: [{"kind"=>"person"}]
Segment.where("payload @> ?", [{kind: "person"}].to_json)
#data: {"interest"=>["music", "movies", "programming"]}
Segment.where("data @> ?", {"interest": ["music", "movies", "programming"]}.to_json)
Segment.where("data #>> '{interest, 1}' = 'movies' ")
Segment.where("jsonb_array_length(data->'interest') > 1")
@julik
julik / kelder.rb
Last active October 22, 2019 22:33
A very very very rough version. There probably will be a gem of this
module Kelder
module PrefixKeyWithToken
# Prefix all generated blob keys with the tenant. Do not
# use slash as a delimiter because it needs different escaping
# depending on the storage service adapter - in some cases it
# might be significant, in other cases it might get escaped as a path
# component etc.
def generate_unique_secure_token
tenant_slug = Apartment::Tenant.current.split('_').last
"#{tenant_slug}-#{super}"
@khalilgharbaoui
khalilgharbaoui / register_chrome_with_window_size.rb
Last active September 8, 2019 05:14 — forked from mars/register_chrome_with_window_size.rb
Set window size for Capybara/Selenium/chromedriver
# This works best in 2019 forward because its basically the code from the gem itself with some tweaks added:
# https://github.com/teamcapybara/capybara/blob/master/lib/capybara/registrations/drivers.rb
# The additional option/flags work for me but you probebly want to checkout what you would need here first:
# https://peter.sh/experiments/chromium-command-line-switches/
Capybara.register_driver :selenium_chrome_headless do |app|
# Capybara::Selenium::Driver.load_selenium
browser_options = ::Selenium::WebDriver::Chrome::Options.new.tap do |opts|
opts.args << '--window-size=1920,1080'
@behroozam
behroozam / Dockerfile
Last active March 4, 2024 12:15
send nginx custom log to elasticsearch with fluentd syslog input
FROM fluent/fluentd:v1.3-1
# Use root account to use apk
USER root
# below RUN includes plugin as examples elasticsearch is not required
# you may customize including plugins as you wish
RUN apk add --no-cache --update --virtual .build-deps \
build-base ruby-dev \
&& gem install \
@bradtraversy
bradtraversy / docker_wordpress.md
Last active June 19, 2024 17:24
Docker Compose FIle For Wordpress, MySQL & phpmyadmin

Wordpress & Docker

This file will setup Wordpress, MySQL & PHPMyAdmin with a single command. Add the code below to a file called "docker-compose.yaml" and run the command

$ docker-compose up -d

# To Tear Down
$ docker-compose down --volumes