Skip to content

Instantly share code, notes, and snippets.

View Ex-Ark's full-sized avatar

Alexis DELAHAYE Ex-Ark

  • France
View GitHub Profile
{
"meta": {"theme": "kendall"},
"basics": {
"name": "Alexis Delahaye",
"label": "Ingénieur Backend Ruby",
"picture": "",
"email": "adelahaye.dev@gmail.com",
"phone": "",
"profiles": [
{
@Ex-Ark
Ex-Ark / .gitlab-ci.yml
Created April 2, 2020 08:23
Gitlab CI config for testing, building static swagger documentation and deploying doc
stages:
- test
- documentation
- deploy
rspec:
stage: test
# Cache gems in between builds
cache:
paths:
@Ex-Ark
Ex-Ark / 00.rspec_stub_google_oauth2_token.rb
Last active May 24, 2022 19:20
How to stub JWT server validation using Google OAuth2 and RSpec
require 'google/apis/oauth2_v2'
shared_context 'stub_google_token_validation' do
before do
allow_any_instance_of(Google::Apis::Oauth2V2::Oauth2Service).to receive(:tokeninfo).and_return(
Google::Apis::Oauth2V2::Tokeninfo.new email: 'your_fake_email_here@rspec.test',
issued_to: Rails.application.secrets[:google_client_id],
audience: Rails.application.secrets[:google_client_id]
)
end
@Ex-Ark
Ex-Ark / 00.Capistrano-Rails-Unicorn-Nginx-Webpack
Last active February 25, 2022 15:31
Rails 6 + webpack assets + capistrano + unicorn + nginx : Zero downtime deploy and code reload
cap staging deploy:check
cap staging deploy
@Ex-Ark
Ex-Ark / Gemfile
Created February 13, 2020 13:51
Rails + Devise + Omniauth Google access_type: 'offline' + Google::Apis::Calendar
gem 'rails', '~> 6.0.0'
gem 'devise'
gem 'omniauth'
gem 'omniauth-google-oauth2'
gem 'google-api-client'
@Ex-Ark
Ex-Ark / cookie_decrypt.rb
Created November 14, 2019 16:51
Extract cookies from chrome SQLite local storage and decrypt them using Windows DPAPI
@Ex-Ark
Ex-Ark / youtube_playlist_block_country_viewer.rb
Last active July 1, 2019 12:36
view the most blocked countries in a youtube playlist
# why : i'm watching a serie on youtube with some episodes blocked in certain country (each time differents ones)
# i don't want to switch my VPN server after each episode and try all servers to find a country allowed
# the script gives me the country less blocked in the entire playlist
# what it does :
# given a playlist url
# parses the playlist without using the google API (scrapping)
# for each video found it calls unblockvideos API
# returns a hash with the number of times a country is blocked
@Ex-Ark
Ex-Ark / presigned_post_json_to_html_form_converter.rb
Created July 5, 2018 13:11
Creates a pure HTML form for a browser-based upload to a AWS S3 compatible server ( like Minio )
presigned_json = {:fields=>{:AWSAccessKeyId=>nil, :key=>"1530784425_light", :policy=>"eyJleHBpcmF0aW9uIjoiMjAxOC0wNy0wNVQxMDoxODo0NVoiLCJjb25kaXRpb25zIjpbeyJidWNrZXQiOiJhM2JjdXNlcnMifSx7ImtleSI6IjE1MzA3ODQ0MjVfbGlnaHQifSx7ImFjbCI6InB1YmxpYy1yZWFkIn0sWyJzdGFydHMtd2l0aCIsIiRDb250ZW50LVR5cGUiLCJpbWFnZS8iXSxbImNvbnRlbnQtbGVuZ3RoLXJhbmdlIiwxLDEwMjQwMDAwMF0seyJ4LWFtei1jcmVkZW50aWFsIjoiYTNiY2FjY2Vzcy8yMDE4MDcwNS9ldS13ZXN0LTMvczMvYXdzNF9yZXF1ZXN0In0seyJ4LWFtei1hbGdvcml0aG0iOiJBV1M0LUhNQUMtU0hBMjU2In0seyJ4LWFtei1kYXRlIjoiMjAxODA3MDVUMDk1MzQ1WiJ9XX0=", "x-amz-signature"=>"8e8d3987682ef7793cf0aca381fe7174155ebfa131cf509b94bffd29da2fb1cb", "x-amz-credential"=>"a3bcaccess/20180705/eu-west-3/s3/aws4_request", "x-amz-date"=>"20180705T095345Z", "x-amz-algorithm"=>"AWS4-HMAC-SHA256", :acl=>"public-read"}, :upload_url=>"http://minio:9000/a3bcusers", :download_url=>"http://minio:9000/a3bcusers/1530784425_light"}
json = presigned_json[:fields]
out = []
out << '<html>
<head>
<meta http-equiv="Content-Type" content="t