Skip to content

Instantly share code, notes, and snippets.

View dmshvetsov's full-sized avatar
🪄

Dmitry Shvetsov dmshvetsov

🪄
View GitHub Profile
@dmshvetsov
dmshvetsov / mongodb-ssl.sh
Created October 8, 2019 12:46 — forked from kevinadi/mongodb-ssl.sh
Script to create self-signed CA certificates, server certificates, and client certificates for testing MongoDB with SSL
#!/bin/sh
# Generate self signed root CA cert
openssl req -nodes -x509 -newkey rsa:2048 -keyout ca.key -out ca.crt -subj "/C=AU/ST=NSW/L=Sydney/O=MongoDB/OU=root/CN=`hostname -f`/emailAddress=kevinadi@mongodb.com"
# Generate server cert to be signed
openssl req -nodes -newkey rsa:2048 -keyout server.key -out server.csr -subj "/C=AU/ST=NSW/L=Sydney/O=MongoDB/OU=server/CN=`hostname -f`/emailAddress=kevinadi@mongodb.com"
# Sign the server cert
@dmshvetsov
dmshvetsov / IAMCredentials.json
Created March 2, 2019 07:37 — forked from ServerlessBot/IAMCredentials.json
Minimum credential set for Serverless Framework
{
"Statement": [
{
"Action": [
"apigateway:*",
"cloudformation:CancelUpdateStack",
"cloudformation:ContinueUpdateRollback",
"cloudformation:CreateChangeSet",
"cloudformation:CreateStack",
"cloudformation:CreateUploadBucket",
@dmshvetsov
dmshvetsov / skcluster.rb
Created February 17, 2017 09:32 — forked from stympy/skcluster.rb
Sidekiq cluster control script and systemd service
#!/usr/bin/env ruby
require 'sidekiq'
require 'sidekiq/cli'
# Default to running one process per core
def process_count
return ENV['SK_PROCESS_COUNT'].to_i unless ENV['SK_PROCESS_COUNT'].to_i == 0
case RbConfig::CONFIG['host_os']
@dmshvetsov
dmshvetsov / rename.rake
Created September 8, 2016 22:59 — forked from invisiblefunnel/rename.rake
Rake task for renaming a Rails app
desc "Rename this application"
task :rename, [:name] => :environment do |t, args|
files = Dir.glob(%w(rb yml).map{ |ext| Rails.root.join("**/*.#{ext}") } + %w(Rakefile))
before = Rails.application.class.name.split('::').first
after = args.name or raise "Pass a new name as an argument: $ rake rename[MyCivicApp]"
files.each do |file|
# Swap in the new name
renamed = File.read(file).gsub(/#{before}/, after).gsub(/#{before.underscore}/, after.underscore)
# Write the updated contents
@dmshvetsov
dmshvetsov / react_ujs.js
Created December 10, 2015 05:09 — forked from rescribet/react_ujs.js
Non-global react_ujs
/*globals React, Turbolinks*/
/* Modified react_ujs to prevent the components polluting global scope whenever possible.
* Since I use subdirs for my components, it also flattens the structure making
* _componentStore[className] possible.
* Creds for the react_ujs.js file to the people from react-rails (https://github.com/reactjs/react-rails)
*/
var path = require('path');