Skip to content

Instantly share code, notes, and snippets.

View simonoff's full-sized avatar
💭
KUBER!!!!

Oleksandr Simonov simonoff

💭
KUBER!!!!
View GitHub Profile
@simonoff
simonoff / openclaw-config-sanitized.json
Created February 7, 2026 16:28 — forked from assada/openclaw-config-sanitized.json
OpenClaw configuration example (tokens sanitized)
{
"meta": {
"lastTouchedVersion": "2026.2.6-3",
"lastTouchedAt": "2026-02-07T12:27:15.401Z"
},
"wizard": {
"lastRunAt": "2026-02-06T10:50:01.627Z",
"lastRunVersion": "2026.2.3-1",
"lastRunCommand": "doctor",
"lastRunMode": "local"
@simonoff
simonoff / neo-theme.lua
Created July 19, 2024 07:44
nvim indent highlight
vim.o.background = 'dark'
local c = require('vscode.colors').get_colors()
require('vscode').setup({})
require('vscode').load()
require('nvim-web-devicons').setup {}
require("bufferline").setup({
options = {
@simonoff
simonoff / net_http_debug.rb
Created November 17, 2022 10:00 — forked from brainlid/net_http_debug.rb
Enable debug for all Ruby HTTP requests
require 'net/http'
module Net
class HTTP
def self.enable_debug!
class << self
alias_method :__new__, :new
def new(*args, &blk)
instance = __new__(*args, &blk)
instance.set_debug_output($stderr)
instance
class Sidekiq::Logger::Formatters::Jsoner < Sidekiq::Logger::Formatters::Base
def call(severity, time, program_name, message)
hash = {
application: "prog-sidekiq",
time: time.utc.to_i,
level: severity,
tid: tid,
message: message
}
c = ctx
# Adapted from a C# example here:
# http://stackoverflow.com/questions/43224/how-do-i-calculate-a-trendline-for-a-graph
# And thanks to John Esser for helping figure out how to
# calculate the targets to stabilize a negative slope!
class LinearRegression
attr_accessor :slope, :intercept
# Pass in an array of values to get the regression on
set :systemd_services, {.
puma: {
cmd: 'puma -p 3000',
cpu_quota: 10
},
sidekiq: {
cmd: 'sidekiq',
cpu_quota: 10
}
}
@simonoff
simonoff / gist:7792049
Last active December 30, 2015 06:49
in_groups_of faster then each_slice ?!!!
a = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]
n = 1000000
Benchmark.bm do |x|
x.report('in_groups_of') { n.times { a.in_groups_of(7, false).select{|x| x.size == 7} } }
x.report('each_slice') { n.times { a.each_slice(7).select{|x| x.size == 7} } }
x.report('each_slice with result') { n.times { res = []; a.each_slice(7) {|x| res << x if x.size == 7 }; } }
end
# user system total real
#in_groups_of 4.690000 0.010000 4.700000 ( 4.745116)
# RSpec matcher to spec delegations.
# Forked from https://gist.github.com/ssimeonov/5942729 with fixes
# for arity + custom prefix.
#
# Usage:
#
# describe Post do
# it { should delegate(:name).to(:author).with_prefix } # post.author_name
# it { should delegate(:name).to(:author).with_prefix(:any) } # post.any_name
# it { should delegate(:month).to(:created_at) }
task :teamcity => ['teamcity:clean', 'teamcity:setup', 'barista:brew', 'fork:spec', 'teamcity:cucumber', 'jasmine:ci']
namespace :teamcity do
task :setup do
RAILS_ENV = 'test'
Rake::Task['db:drop'].invoke
Rake::Task['db:create'].invoke
Rake::Task['db:schema:load'].invoke
end
  • This creates a 560mb ramdisk. Adjust the size accordingly. I think the number at the end of the command is the number of disk blocks. They are 2kb in size for me.
  • Restarting postgres is not necessary; you can create the ramdisk and tablespace while postgres is running.
  • You will lose all data in the ramdisk tablespace when you shut your machine down

  $ diskutil erasevolume HFS+ "postgres_ramdisk" `hdiutil attach -nomount ram://1165430`
  Started erase on disk1
  Unmounting disk
  Erasing
 Initialized /dev/rdisk1 as a 569 MB HFS Plus volume