Recent Updates Toggle Comment Threads | Keyboard Shortcuts

  • ThomasPowell 11:01 am on July 20, 2020 Permalink  

    Planet Fitness Cancellation Template 

    Update: I put this in the mail on Tuesday and got cancellation confirmation less than 48 hours later.

    Also, your mileage may vary, some locations are a little more of a stickler about certified mail, but you should get a confirmation from the location within a few days if they’ve accepted.

    I needed to cancel Planet Fitness in the middle of the COVID-19 pandemic and I really didn’t want to be showing up at a gym in person right now (time and unnecessary risk) just to cancel.

    I called up my local Planet Fitness and was told I could either come in in person *or* send a [yes, snail mail] letter to the Planet Fitness I signed up at.

    So, I’ve thrown together a cheap template to help you include everything you need to cancel (it’s just name, date of birth, and signature, according to the person on the phone.)

    You can download the doc I put together at: Planet Fitness Cancellation Word Doc template

     
  • ThomasPowell 5:16 pm on May 15, 2022 Permalink | Reply
    Tags: filament, gcode, silk pla   

    Quickly modifying gcode for higher temp silk (205℃) PLA (TTYT3D Rainbow) 

    New Silk PLA, New Problems

    I bought some new rainbow filament (TTYT3D Rainbow silk PLA), and was able to print the dog phone holder without modifications to the temperature settings for the bed or hotend. You’ll notice some slight imperfections in the skirt, and there was a bit of filament I had to trim off the finished product.

    Dog phone holder rainbow print, no gcode modifications needed

    Of course, even if I had needed to change the temperature settings as I later found in the reviews for the above filament, I had the .stl file, so I could have adjusted it in CURA.

    Cat 3.5H Print

    I have a print of the cat (maneki-neko) model that came with my Creality Ender 3 Pro 3D Printer for every filament that I’ve bought, so I tried with both glass and magnetic bed, releveling a few times. Each print would either fail to adhere to the bed at some point or flow of the filament would clog and force the model loose.

    I found in the reviews for the filament that 215℃ for the hotend 60℃ for the bed would be better for printing, but the file that comes on the included SD card is in .gcode format. You can find .stl versions of the same model, but I wanted to otherwise keep the same file… so I needed to hand edit the source (since at least Cura wasn’t going to help me).

    Successful cat print after gcode edit

    Editing the gcode

    Copy the gcode file before anything else and edit the copy. For editing, VSCode has a number of gcode plugins to help highlight the code if you wish.

    You need to find instances of the following codes in your file:

    • M140 – Set Bed Temperature
    • M190 – Wait for Bed Temperature
    • M104 – Set Hotend Temperature
    • M109 – Wait for Hotend Temperature

    Original gcode

    M106 S0
    M140 S45
    M190 S45
    M104 S200 T0
    M109 S200 T0

    New gcode

    M106 S0
    M140 S60
    M190 S60
    M104 S215 T0
    M109 S215 T0

    Don’t be misled by comments

    The lines beginning with semicolons are comments. Without syntax highlighting, I had just blindly searched on “temperature” but you really need to find the M* codes setting the printer settings.

    ;   temperatureNumber,0,0
    ;   temperatureSetpointCount,1,1
    ;   temperatureSetpointLayers,1,1
    ;   temperatureSetpointTemperatures,215,60
    ;   temperatureStabilizeAtStartup,1,1

    As seen above, the updated settings allowed the print to complete.

     
  • ThomasPowell 11:28 am on May 12, 2022 Permalink | Reply
    Tags: pem, public key, rsa   

    Convert a pem file into an rsa private and public key

    `openssl rsa -in yourfile.pem -out yourfile_rsa`
    `chmod 400 yourfile_rsa`
    `openssl rsa -in yourfile.pem -pubout > yourfile_rsa.pub`

    and `ssh -i yourfile_rsa.pub [email protected]` to connect

     
  • ThomasPowell 1:54 pm on May 9, 2022 Permalink | Reply  

    Ruby on Rails + Docker links
    https://evilmartians.com/chronicles/ruby-on-whales-docker-for-ruby-rails-development
    https://docs.docker.com/samples/rails/

    Dockerize your Rails app

    Dependencies

    • Bash
    • Docker

    Quick Start

    1. Update Postgres and Redis connection configurations

      # config/database.yml
      host: postgres
      port: 5432
      username: postgres
      password: password
      # config/initializers/sidekiq.rb
      Sidekiq.configure_server do |config|
        config.redis = {url: "redis://redis_queue:6379/1"}
      end
      
      Sidekiq.configure_client do |config|
        config.redis = {url: "redis://redis_queue:6379/1"}
      end
      # config/environments/development.rb
      config.cache_store = :redis_cache_store, {
        url: "redis://redis_cache:6379/1"
      }
    2. Create redis configuration files

      Use the example files provided by Redis. https://raw.githubusercontent.com/redis/redis/6.0/redis.conf

      • config/redis-cache.conf – setup for LRU cache

        maxmemory 128mb
        maxmemory-policy allkeys-lru
        
      • config/redis-queue.conf

    3. Run the app and all it’s services

      bin/docker/up

      Note: It’s possible that some services may not start on first boot. Simply run bin/docker/restart if anything fails to start.

    4. Develop on the host OS using your preferred editor and tools

    Containers

    This setup will create the following Docker containers for your Rails application.

    • postgres – the primary database
    • redis_cache – the application cache
    • redis_queue – the background job queue
    • web – the rails web server
    • worker – the rails background job runner
    • webpack – the dev server that serves webpack assets
    • shell – a container dedicated to running scripts (bash commands, rails commands, etc…)

    Shared Volumes

    The docker containers mount the following volumes on the host.
    This ensures that data is preserved even when containers are destroyed.

    • .docker_volumes/postgres
    • .docker_volumes/redis_cache
    • .docker_volumes/redis_queue

    Binstubs

    • bin/docker/up – starts the entire containerized environment

    • bin/docker/down – stops all services and removes containers, networks, volumes, and images

    • bin/docker/start – starts stopped containers

      bin/docker/start
      bin/docker/start web
      bin/docker/start webpack
      bin/docker/start worker
    • bin/docker/stop – stops containers without removing them

      bin/docker/stop
      bin/docker/stop web
      bin/docker/stop webpack
      bin/docker/stop worker
    • bin/docker/restart – restarts containers

      bin/docker/restart
      bin/docker/restart web
      bin/docker/restart webpack
      bin/docker/restart worker
    • bin/docker/attach – attach to container, useful for debugging with pry and byebug

      bin/docker/attach web
      bin/docker/attach webpack
      bin/docker/attach worker
      <CTRL-P><CTRL-Q>
    • bin/docker/exec – executes a command inside a container

      bin/docker/exec bash
    • bin/docker/tail – tail logs in a container

      bin/docker/tail web
      bin/docker/tail webpack
      bin/docker/tail worker
    • bin/docker/rails – executes a rails command inside a container

      bin/docker/rails c
      bin/docker/rails db:migrate
      bin/docker/rails credentials:edit    

    Debugging

    1. Add a breakpoint to the project

      binding.pry
    2. Attach to the appropriate container to debug

      bin/docker/attach web
    3. Detach from the container when finished

      <CTRL-P><CTRL-Q>

    view raw

    README.md

    hosted with ❤ by GitHub


    #!/usr/bin/env bash
    # These binstubs should be saved as individual files under bin/docker/
    # bin/docker/up
    mkdir -p .docker_volumes/postgres
    mkdir -p .docker_volumes/redis_cache
    mkdir -p .docker_volumes/redis_queue
    mkdir -p .docker_volumes/bundle
    docker-compose up -d $1
    # bin/docker/down
    docker-compose down $1
    # bin/docker/start
    docker-compose start $1
    # bin/docker/stop
    docker-compose stop $1
    # bin/docker/restart
    docker-compose restart $1
    # bin/docker/attach
    project=$(basename $(pwd))
    docker attach $project$1
    # bin/docker/exec
    project=$(basename $(pwd))
    docker exec -it $project-shell $1 $2 $3 $4 $5
    # bin/docker/tail
    project=$(basename $(pwd))
    docker logs -f $project$1
    # bin/docker/rails
    bin/docker/exec bin/rails $1 $2 $3 $4 $5

    view raw

    binstubs.sh

    hosted with ❤ by GitHub


    version: "3.9"
    networks:
    main:
    services:
    postgres:
    image: postgres:13
    container_name: YOUR_PROJECT_NAME-postgres
    restart: unless-stopped
    environment:
    POSTGRES_PASSWORD: password
    networks:
    main
    expose:
    5432
    volumes:
    ./log:/var/log:delegated
    ./.docker_volumes/postgres:/var/lib/postgresql/data:delegated
    healthcheck:
    test: pg_isready -U postgres
    interval: 10s
    timeout: 1s
    retries: 10
    redis_cache:
    image: redis
    container_name: YOUR_PROJECT_NAME-redis-cache
    restart: unless-stopped
    networks:
    main
    expose:
    6379
    volumes:
    ./log:/var/log:delegated
    ./.docker_volumes/redis_cache:/data:delegated
    ./config/redis-cache.conf:/usr/local/etc/redis/redis.conf:cached
    healthcheck:
    test: redis-cli ping
    interval: 10s
    timeout: 1s
    retries: 10
    redis_queue:
    image: redis
    container_name: YOUR_PROJECT_NAME-redis-queue
    restart: unless-stopped
    networks:
    main
    expose:
    6379
    volumes:
    ./log:/var/log:delegated
    ./.docker_volumes/redis_queue:/data:delegated
    ./config/redis-queue.conf:/usr/local/etc/redis/redis.conf:cached
    healthcheck:
    test: redis-cli ping
    interval: 10s
    timeout: 1s
    retries: 10
    shell:
    build: .
    image: YOUR_PROJECT_NAME
    container_name: YOUR_PROJECT_NAME-shell
    working_dir: /YOUR_PROJECT_NAME
    command: /bin/bash -c "rm -f tmp/shell-ready.txt && yarn && bundle && bin/rails db:create db:migrate && touch tmp/shell-ready.txt && tail -f /dev/null"
    environment:
    BUNDLE_PATH: /bundle
    EDITOR: /usr/bin/vim
    networks:
    main
    volumes:
    ./:/YOUR_PROJECT_NAME:cached
    ./.docker_volumes/bundle:/bundle:delegated
    depends_on:
    postgres:
    condition: service_healthy
    redis_cache:
    condition: service_healthy
    redis_queue:
    condition: service_healthy
    healthcheck:
    test: test -f tmp/shell-ready.txt
    interval: 30s
    timeout: 1s
    retries: 40
    webpack:
    image: YOUR_PROJECT_NAME
    container_name: YOUR_PROJECT_NAME-webpack
    working_dir: /YOUR_PROJECT_NAME
    command: /bin/bash -c "bin/webpack-dev-server"
    environment:
    BUNDLE_PATH: /bundle
    EDITOR: /usr/bin/vim
    WEBPACKER_DEV_SERVER_HOST: 0.0.0.0
    networks:
    main
    volumes:
    ./:/YOUR_PROJECT_NAME:delegated
    ./.docker_volumes/bundle:/bundle:cached
    ports:
    3035:3035
    depends_on:
    shell:
    condition: service_healthy
    healthcheck:
    test: curl -I http://localhost:3035
    interval: 20s
    timeout: 1s
    retries: 10
    web:
    image: YOUR_PROJECT_NAME
    container_name: YOUR_PROJECT_NAME-web
    working_dir: /YOUR_PROJECT_NAME
    command: /bin/bash -c "rm -f tmp/pids/server.pid && bin/rails s –binding=0.0.0.0 –port=3000"
    tty: true
    stdin_open: true
    environment:
    BUNDLE_PATH: /bundle
    EDITOR: /usr/bin/vim
    WEBPACKER_DEV_SERVER_HOST: webpack
    networks:
    main
    volumes:
    ./:/YOUR_PROJECT_NAME:cached
    ./.docker_volumes/bundle:/bundle:delegated
    ports:
    3000:3000
    depends_on:
    webpack:
    condition: service_healthy
    healthcheck:
    test: curl -I http://localhost:3000
    interval: 20s
    timeout: 1s
    retries: 10
    worker:
    image: YOUR_PROJECT_NAME
    container_name: YOUR_PROJECT_NAME-worker
    working_dir: /YOUR_PROJECT_NAME
    command: /bin/bash -c "bundle exec sidekiq -C config/sidekiq.yml"
    tty: true
    stdin_open: true
    environment:
    BUNDLE_PATH: /bundle
    EDITOR: /usr/bin/vim
    networks:
    main
    volumes:
    ./:/YOUR_PROJECT_NAME:cached
    ./.docker_volumes/bundle:/bundle:delegated
    depends_on:
    shell:
    condition: service_healthy


    FROM ruby:3.0-alpine
    RUN apk add –no-cache –update \
    ack \
    bash \
    build-base \
    curl \
    git \
    htop \
    less \
    libsass \
    linux-headers \
    nodejs \
    npm \
    postgresql-client \
    postgresql-dev \
    python2 \
    redis \
    tzdata \
    vim \
    yarn \
    zsh
    RUN gem install bundler
    CMD tail -f /dev/null

    view raw

    Dockerfile

    hosted with ❤ by GitHub

    https://github.com/nickjj/docker-rails-example
    https://github.com/phusion/passenger-docker

     
c
Compose new post
j
Next post/Next comment
k
Previous post/Previous comment
r
Reply
e
Edit
o
Show/Hide comments
t
Go to top
l
Go to login
h
Show/Hide help
shift + esc
Cancel
%d bloggers like this: