This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# this script is used to update the openvpn access server certificates after | |
# certbot renews the certificates | |
# the cron job should be like this: | |
# certbot renew --deploy-hook /usr/local/bin/update-openvpn-certs.sh | |
$DOMAIN = "YOUR_DOMAIN_NAME" | |
./sacli --key "cs.priv_key" --value_file "/etc/letsencrypt/live/$DOMAIN/privkey.pem" ConfigPut | |
./sacli --key "cs.cert" --value_file "/etc/letsencrypt/live/$DOMAIN/cert.pem" ConfigPut | |
./sacli --key "cs.ca_bundle" --value_file "/etc/letsencrypt/live/$DOMAIN/chain.pem" ConfigPut |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Bash shell script for generating self-signed certs. Run this in a folder, as it | |
# generates a few files. Large portions of this script were taken from the | |
# following artcile: | |
# | |
# http://usrportage.de/archives/919-Batch-generating-SSL-certificates.html | |
# | |
# Additional alterations by: Brad Landers | |
# Date: 2012-01-27 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#NOTE: Redirect to HTTPS | |
server { | |
listen 80; | |
listen [::]:80; | |
server_name example.com; | |
return 301 https://example.com$request_uri; | |
} | |
server { | |
listen 443 ssl; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class GenerateCrumbsCsvService | |
def self.perform | |
data = [] | |
Category.where(listed: true, depth: 2).each do |category| | |
crumbs_id = [category.parent.parent._id.to_s, category.parent._id.to_s, category._id.to_s].join("|") | |
crumbs = [category.parent.parent.title, category.parent.title, category.title].join("|") | |
data.push([crumbs, crumbs_id]) | |
end | |
CSV.open("/tmp/crumbs.csv", "w") do |csv| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git remote prune origin | |
git branch -r --merged | grep origin | grep -v '>' | grep -v master | grep -v dev | xargs -L1 | awk '{sub(/origin\//,"");print}' | xargs git push origin --delete |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def export_orders_promo_info_csv(start_date, end_date) | |
# start_date and end_date params should be Date objects | |
rows = [] | |
rows << ["order_number", "status", "sub_total", "total", "discount", "promotion_code"] | |
Order::History.where(order_number: /^WO/, finalized_at: start_date..end_date).each do |order| | |
row = [] | |
row << order.order_number | |
row << order.status | |
row << order.final_sub_total | |
row << order.final_total |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sync_updates to: ProductGroup::Dimension::Option, with: DimensionOption::SyncWorker, fields: [:all], after: [] | |
sync_updates to: Product, # with: Admin::Data::SyncWorker | |
perform(source_class, dest_class, source_id, fields) | |
# finds all types of to models that contain the source_id | |
# e.g. Products that embed property_ids | |
# e.g. ProductGroup::Dimension::Option that have property_id of XXX | |
# enqueues individual update jobs for each record update, using sidekiq batch | |
ProductGroup.where("dimensions.options.property_id" => property_id) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find . -type d -exec chmod 0700 '{}' \; | |
find . -type f -exec chmod 0600 '{}' \; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Webpack Config File | |
// Allows import of: | |
// CSS styles | |
// Fonts | |
// CSV/TSV data | |
// XML data | |
const path = require('path'); | |
module.exports = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Mongoid::Migration | |
# renames a collection in mongodb, can be told to drop the target collection first | |
def self.rename_collection(old_name, new_name, drop_target=false) | |
client = Mongoid::Clients.default | |
current_db = client.database | |
admin_db = Mongo::Database.new(client, Mongo::Database::ADMIN, current_db.options) | |
admin_db.command(renameCollection: "#{current_db.name}.#{old_name}", | |
to: "#{current_db.name}.#{new_name}", | |
dropTarget: drop_target) | |
end |
NewerOlder