Skip to content

Instantly share code, notes, and snippets.

View suhovius's full-sized avatar
🤘
Metal

Suhovius suhovius

🤘
Metal
View GitHub Profile
❯ ollama run llama3.1
>>> create app-volume pod with container image 'gcr.io/kuar-demo/kuard-amd64:1' named 'app' and open container port 8080 with name 'http' with livenessProbe http get at port 8080 with settin
... gs: initial delay seconds 5, timeout seconds 1, period seconds 10, failure threshold 3 and readinessProbe at path /ready port 8080 with settings: period seconds 2, initial delay seconds
... 0, failure threshold 3, success threshold 1. Add volume mount named 'data' at host path /var/lib/app to mounted at /data
Here is the YAML configuration for a Kubernetes Pod that meets your requirements:
```
apiVersion: v1
kind: Pod
metadata:
name: app-volume
@suhovius
suhovius / gist:37accd30d2aac0c1ea8f4851b27e33d0
Created July 30, 2024 18:22
Ollama + Kubernetes Experiments
ollama run llama3
>>> create app pod labeled 'app=demo, run=demo' with container image 'gcr.io/k8s-k3s/demo:v1.0.0'  named 'app' and open container port 8000 with name 'http'
Here is the YAML file to create an App of Pod labeled 'app=demo, run=demo' with a container image 'gcr.io/k8s-k3s/demo:v1.0.0', named 'app', and opening container port 8000 with name
'http':
```yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: demo
@suhovius
suhovius / rails-jsonb-queries
Created August 31, 2023 14:49 — forked from mankind/rails-jsonb-queries
Ruby on Rails-5 postgresql-9.6 jsonb queries
http://stackoverflow.com/questions/22667401/postgres-json-data-type-rails-query
http://stackoverflow.com/questions/40702813/query-on-postgres-json-array-field-in-rails
#payload: [{"kind"=>"person"}]
Segment.where("payload @> ?", [{kind: "person"}].to_json)
#data: {"interest"=>["music", "movies", "programming"]}
Segment.where("data @> ?", {"interest": ["music", "movies", "programming"]}.to_json)
Segment.where("data #>> '{interest, 1}' = 'movies' ")
Segment.where("jsonb_array_length(data->'interest') > 1")
@suhovius
suhovius / 1. Success.rb
Created January 3, 2023 23:22 — forked from Integralist/1. Success.rb
How to clone a Hash (in Ruby) and modify the cloned hash without affecting the original object
# This is the ONLY way I've found that works
# All other suggested solutions (see below examples) don't actually work
# And as an extra bonus: this deep copies as well!
def deep_copy(o)
Marshal.load(Marshal.dump(o))
end

So I built a dummy Rails-plugin gem...

rails plugin new foo --skip-bundle -O --full

and filled in my .gemspec as below, including the line

s.add_dependency "rails-assets-sugar"

and added

@suhovius
suhovius / extconfig.rb
Created October 16, 2021 17:45 — forked from ForeverZer0/extconfig.rb
Automatically include/compile all Ruby C extension source files (including subdirectories) using mkmf
require "mkmf"
ext_name = 'my_extension'
excluded = ['x86', 'x64']
dir_config(ext_name)
$srcs = Dir.glob("#{$srcdir}/**/*.c").map { |path| File.basename(path) }
Dir.glob("#{$srcdir}/*/") do |path|
dir = File.basename(path)
@suhovius
suhovius / create-ruby-gem-that-adds-rake-tasks.md
Created October 15, 2021 23:23 — forked from ntamvl/create-ruby-gem-that-adds-rake-tasks.md
How to create a Ruby gem that adds Rake tasks

How to create a Ruby gem that adds Rake tasks

Create a gem

One way to do this is to use bundler to scaffold our gem:

bundler gem my_gem

Add rake tasks to our gem

I prefer to put tasks meant to manage the gem itself in lib/tasks, and tasks the gem is meant to provide to gem users in lib/my_gem/tasks.

@suhovius
suhovius / rails_setup.md
Created July 21, 2021 16:45 — forked from ryanflach/rails_setup.md
Common setup for a new Rails project
  1. rails new <project_name> -d postgresql --skip-turbolinks --skip-spring -T
  • -d postgresql sets up the project to use PostgreSQL
  • --skip-turbolinks & --skip-spring creates a project that does not use turbolinks or spring
  • -T skips the creation of the test directory and use of Test::Unit
  1. In the Gemfile:
  • Available to all environments:
    • gem 'figaro' - store environment variables securely across your app (docs)
    • Uncomment gem 'bcrypt', '~> 3.1.7' if you will be hosting your own user accounts with passwords (docs)
  • Inside of group :test:
    • gem 'rspec-rails' - user rspec in place of minitest (docs)
@suhovius
suhovius / main.rb
Created June 23, 2021 21:07 — forked from thlinux1107/main.rb
Paya Connect - AccountForm - CC. ACH Works the same way.
# /*----------------------------------------------
# Author: SDK Support Group
# Company: Paya
# Contact: [email protected]
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# !!! Samples intended for educational use only!!!
# !!! Not intended for production !!!
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# -----------------------------------------------*/
@suhovius
suhovius / Big List of Real Estate APIs.md
Created June 27, 2019 01:07 — forked from patpohler/Big List of Real Estate APIs.md
Evolving list of Real Estate APIs by Category

Big List of Real Estate APIs

Listings / Property Data

####Rets Rabbit http://www.retsrabbit.com

Rets Rabbit removes the nightmare of importing thousands of real estate listings and photos from RETS or ListHub and gives you an easy to use import and Web API server so you can focus on building your listing search powered website or app.