Skip to content

Instantly share code, notes, and snippets.

Sam SamSaffron

Block or report user

Report or block SamSaffron

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View i3-plus
#!/usr/bin/env ruby
require 'i3ipc'
class I3Helper
def initialize
@i3 = I3Ipc::Connection.new
end
def tree
View i3-plus
#!/usr/bin/env ruby
require 'i3ipc'
class I3Helper
def initialize
@i3 = I3Ipc::Connection.new
end
def tree
View i3-plus
#!/usr/bin/env ruby
require 'i3ipc'
class I3Helper
def initialize
@i3 = I3Ipc::Connection.new
end
View i3-plus
#!/usr/bin/env ruby
require 'i3ipc'
class I3Helper
def initialize
@i3 = I3Ipc::Connection.new
end
View smartmove
#!/usr/bin/env ruby
# replacement for i3 move left / right command, behavior changes depending on if your window in floated or not
require 'i3ipc'
class Mover
def initialize
@i3 = I3Ipc::Connection.new
end
View test.rb
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'pg'
gem 'activerecord', '5.2.0'
gem 'benchmark-ips'
end
require 'active_record'
View meetup.rb
#!/usr/bin/env ruby
fail "API_KEY required" unless key = ENV["API_KEY"]
fail "API_USERNAME required" unless username = ENV["API_USERNAME"]
require "set"
require "date"
require "json"
json = JSON.parse(`curl -s "https://dev.discourse.org/t/7433.json?include_raw=true&api_username=#{username}&api_key=#{key}"`)
View cache_critical_dns.rb
require 'resolv'
require 'time'
require 'timeout'
# HOSTS = "/etc/hosts"
HOSTS_PATH = "hosts"
CRITICAL_HOST_ENV_VARS = %w{
DISCOURSE_DB_HOST
DISCOURSE_DB_BACKUP_HOST
DISCOURSE_REDIS_HOST
View memsize_of.rb
#require_relative '../rerunner/rerunner.rb'
require 'objspace'
x = "hello1" * 10_000
puts ObjectSpace.memsize_of(x)
# 60041
x1 = "hello2" * 10_000
puts ObjectSpace.memsize_of(x1)
# 60041
View test.rb
# playing with search ...
require_relative '../rerunner/rerunner.rb'
require 'maxminddb'
require 'ipaddr'
# $LOAD_PATH.unshift('/home/sam/Source/memory_profiler/lib')
require 'memory_profiler'
You can’t perform that action at this time.