Skip to content

Instantly share code, notes, and snippets.

View scicco's full-sized avatar

scicco

View GitHub Profile
@scicco
scicco / run_gitlab_runner.sh
Created March 7, 2023 16:31
run_gitlab_runner.sh
#!/bin/bash
docker run -d \
--name gitlab-runner \
--restart always \
-v /var/run/docker.sock:/var/run/docker.sock \
-v gitlab-runner-config:/etc/gitlab-runner \
gitlab/gitlab-runner
docker logs -f gitlab-runner
@scicco
scicco / register_gitlab_runner.sh
Last active March 7, 2023 16:32
register_gitlab_runner.sh
#!/bin/bash
docker run --name gitlab-runner-register -d \
-v /var/run/docker.sock:/var/run/docker.sock \
-v gitlab-runner-config:/etc/gitlab-runner \
gitlab/gitlab-runner register \
--non-interactive \
--executor "docker" \
--docker-image alpine:latest \
--url "<GITLAB_URL_HERE>" \
--registration-token "<TOKEN_HERE>" \
@scicco
scicco / stop_gitlab_runner.sh
Created March 7, 2023 16:30
stop_gitlab_runner.sh
#!/bin/bash
docker ps -a | grep runner | cut -d' ' -f1 | xargs -d $'\n' bash -c 'for arg do docker stop -t 1 "$arg"; docker rm "$arg"; done' _
@scicco
scicco / clear_github_runner.sh
Created March 7, 2023 16:29
clear_github_runner.sh
#!/bin/bash
docker volume rm gitlab-runner-config
docker volume create gitlab-runner-config
@scicco
scicco / yarn_licences_csv.rb
Last active February 8, 2023 16:14
yarn_licences_csv.rb
# "@ampproject/remapping", # name
# "2.2.0", # version
# "Apache-2.0", # license
# "git+https://github.com/ampproject/remapping.git", # repository
# "Unknown", # homepage
# "Justin Ridgewell" # author
require 'json'
require 'csv'
# Read data from the JSON file
file = File.read('yarn_licenses.json')
@scicco
scicco / rails_new_api_service
Created January 4, 2022 09:28
create new Rails API service
rails new my_api_service \
--skip-action-mailer \
--skip-action-mailbox \
--skip-action-cable \
--skip-action-text \
--skip-asset-pipeline \
--skip-javascript \
--skip-hotwire \
--skip-bootsnap \
--skip-system-test \
@scicco
scicco / devise_pwned_passwords_hooks.rb
Created March 15, 2021 14:31
Devise - Check if existing user has weak passwords and force password change
Warden::Manager.after_set_user except: :fetch do |user, auth, opts|
if user.class.respond_to?(:pwned_password_check_on_sign_in) && user.class.pwned_password_check_on_sign_in
password = auth.request.params.fetch(opts[:scope], {}).fetch(:password, nil)
is_pwned = password && auth.authenticated?(opts[:scope]) && user.respond_to?(:password_pwned?) && user.password_pwned?(password)
if is_pwned
Devise.sign_out_all_scopes
if defined?(::Devise::Models::Recoverable) && user.respond_to?(:send_reset_password_instructions)
user.send_reset_password_instructions
message = :pwned_recoverable
else
@scicco
scicco / print_ruby_version.sh
Last active July 3, 2020 09:04
print .ruby-version file of all subfolders
#!/bin/bash
for file in *;
do
if [ -f "./$file/.ruby-version" ]; then
cat "$file/.ruby-version" | sed -e 's/ruby-//g' | tr '\n' ' ';
echo "in folder: $file";
fi
done;
### example:
@scicco
scicco / mapbox_webgl_error.log
Last active March 17, 2020 14:11
mapbox compiler error
Failed running python -E "/Applications/Unity/Hub/Editor/2019.3.5f1/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/emcc" @"/Users/username/prj/Lzero/Assets/../Temp/emcc_arguments.resp"
stdout:
stderr:warning: unexpected number of arguments 1 in call to '__cxa_pure_virtual', should be 0warning: unexpected number of arguments 2 in call to '_ZN6il2cpp6icalls8mscorlib6System6String22RedirectToCreateStringEv', should be 0warning: unexpected number of arguments 4 in call to '_ZN6il2cpp6icalls8mscorlib6System6String22RedirectToCreateStringEv', should be 0warning: unexpected number of arguments 2 in call to '_ZN6il2cpp6icalls8mscorlib6System6String22RedirectToCreateStringEv', should be 0warning: unexpected number of arguments 4 in call to '_ZN6il2cpp6icalls8mscorlib6System6String22RedirectToCreateStringEv', should be 0warning: unexpected number of arguments 5 in call to '_ZN6il2cpp6icalls8mscorlib6System6String22RedirectToCreateStringEv', should b
@scicco
scicco / check local certificate
Created August 30, 2018 09:26
check configuration of a local certificate
openssl s_client -CApath /etc/ssl/certs/ -connect address.com:443