Skip to content

Instantly share code, notes, and snippets.

shipping_rules = [
{
brand_name: 'Bella + Canvas',
free_shipping_threshold: 200,
shipping_fees: {
fastest: 9.95,
standard: 0.00,
economy: 5.45
},
discount_coupon_allowed: false,
brand_and_catalog_numbers = {
'Bella + Canvas' => ['BST323', 'BST323C'],
'Bayside' => ['1900J1'],
'LAT' => ['J0041', 'J0042'],
'Rabbit Skins' => ['J0051', 'J0052'],
'US Blanks' => ['USFM47'],
'Next Level' => ['NLM100', 'NLM101']
}
brand_and_catalog_numbers.each do |brand_name, catalog_numbers|
@iarie
iarie / find_stuck_processing_shipments.rb
Last active June 8, 2020 13:35
Find stuck shipments by criteria: shipment should have similar
# May
interval = Date.new(2020, 5, 1).all_month
stock_location_ids = Spree::Supplier.alphabroder.stock_location_ids
order_ids = Spree::Order.joins(:shipments).where(
completed_at: interval,
spree_shipments: {
state: 'processing',
stock_location_id: stock_location_ids
}
# Get Status
get_status = -> (po_number) do
r = Supplier::Alphabroder::OrderStatusV2::GetOrderStatus.new.call(po_number)
doc = Nokogiri::XML(r.body)
nodes = doc.xpath("//order[not(shipstatus)]")
pnode = Supplier::Alphabroder::OrderStatusV2::OrderXmlNode.new(nodes)
pnode.ship_method_nodes.map do |n|
{
number: n.shipper_number,
@iarie
iarie / fix_stucked_shipments.rb
Last active June 10, 2020 10:21
all in one gist
interval = Date.new(2020, 5, 1)..Date.new(2020, 6, 7)
module FixStuckShipments
FINAL_STATES = %w[
shipped
canceled
].freeze
SHIPMENT_STATUS_MAP = {
'Complete' => 'shipped',
@garg-aayush
garg-aayush / setup-personal-gpu-server.md
Created June 30, 2024 15:35
Step-by-Step Guide to setup your own personal GPU server

Setting Up Your Personal GPU Server: A Step-by-Step Guide

I've been using a GPU workstation with an RTX 4090 for almost a year now, and it's been one of the best decisions I've made. With a personal GPU server, you no longer need to rely on cloud-based GPU instances from services like RunPod or Vast.ai every time you want to run a job or try new models. The best part? No stress about recurring GPU instance costs! :-)

However, I rarely work directly on my workstation. Instead, I prefer the flexibility of accessing the GPU remotely using my MacBook, whether I'm working from different locations within my home, from a co-working space, or a cozy cafe in another part of town.

In this blog, I will walk you through the steps to configure a personal GPU Ubuntu server.

For this guide, I assume you already have a workstation running Ubuntu with a GPU and it is connected to your local network